Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action for Hook Documentation Generation #2060

Merged
merged 11 commits into from
Aug 18, 2023

Conversation

puntope
Copy link
Contributor

@puntope puntope commented Aug 17, 2023

Changes proposed in this Pull Request:

This PR creates an Action for generating PHP Hooks documentation when PHP files change.

It will commit a README.md in src/Hooks/README.md

Screenshots

Screenshot 2023-08-17 at 15 04 53 Screenshot 2023-08-17 at 15 03 52

Detailed test instructions:

  1. Verify how the README.md has been generated in src/HOOKS/README.md
  2. Check in the file diff the links working and it's most likely as it was before.
  3. See the workflow is triggered on release branches. Release/hook docs test #2064

Additional details:

Changelog entry

Dev - Add Action for Hooks Documentation Generator

@github-actions github-actions bot added the changelog: dev Developer-facing only change. label Aug 17, 2023
@puntope puntope self-assigned this Aug 17, 2023
@puntope puntope requested a review from a team August 17, 2023 11:16
@puntope puntope marked this pull request as ready for review August 17, 2023 11:17
@puntope puntope changed the title Add action for Hook generation Add action for Hook Documentation Generation Aug 17, 2023
@puntope
Copy link
Contributor Author

puntope commented Aug 17, 2023

At first, this Workflow was triggered when a push event happened with some PHP files.

After discussion with the team, now we changed the trigger to only run on release branches.

You can see the trigger in another release branch here: #2064

@puntope puntope marked this pull request as draft August 18, 2023 07:33
@puntope puntope marked this pull request as ready for review August 18, 2023 09:08
Copy link
Contributor

@mikkamp mikkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes they seem to be working well as far as I can see. The workflow is triggered and commits a new version of src/Hooks/README.md when a release branch is update.

As far as I understand we also want to maintain only one script within our grow repo. So the script bin/HooksDocsGenerator.php can be removed.

I just left a few minor comments but this should be pretty much good to go, so I'll mark the PR as approved.

@@ -0,0 +1,57 @@
name: PHP Hook Documentation Generator

on:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The push and pull_request (with the PHP filter), look fine to me. But I was wondering if it would do any harm to also allow us to run this manually, like here. It's not going to effect our automated flows, and will make it easier if we ever want to run it manually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this suggestions

uses: woocommerce/grow/hook-documentation@actions-v1
with:
debug-output: yes
source-directories: src/,views/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the main plugin file google-listings-and-ads.php? Is this strictly a list of directories or does it support single files as well?

It so happens we don't have any hooks there now, but considering we want to use it for other extensions the script should be flexible enough to include the main plugin file. If that's not possible then can we log an issue in the Grow repo that this should be fixed?

Copy link
Contributor Author

@puntope puntope Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like its possible as internally it uses Finder()->path()

You can see it here in a test when I added gla_test_action inside the main plugin file.

Screenshot 2023-08-18 at 17 03 01

https://github.com/woocommerce/google-listings-and-ads/actions/runs/5902917550/job/16011805311

@puntope puntope merged commit b8f3d11 into develop Aug 18, 2023
2 checks passed
@puntope puntope deleted the dev/action-hooks-generator branch August 18, 2023 13:07
@eason9487 eason9487 mentioned this pull request Aug 22, 2023
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: dev Developer-facing only change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants