-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Workflow for generating Hooks Documentation
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: PHP Hook Documentation Generator | ||
|
||
on: | ||
push: | ||
branches: | ||
- "release/**" | ||
paths: | ||
- "**.php" | ||
- .github/workflows/php-hook-documentation.yml | ||
pull_request: | ||
types: | ||
- opened | ||
branches: | ||
- "release/**" | ||
paths: | ||
- "**.php" | ||
- .github/workflows/php-hook-documentation.yml | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
HookDocumentation: | ||
name: Hook Documentation Generator | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
# Checks out a branch instead of a commit in detached HEAD state | ||
ref: ${{ github.head_ref }} | ||
|
||
# This generates the documentation string. The `id` property is used to reference the output in the next step. | ||
- name: Generate hook documentation | ||
id: generate-hook-docs | ||
uses: woocommerce/grow/hook-documentation@actions-v1 | ||
with: | ||
debug-output: yes | ||
source-directories: includes/ woocommerce-google-analytics-integration.php | ||
|
||
- name: Commit hook documentation | ||
shell: bash | ||
# Use the github-actions bot account to commit. | ||
# https://api.github.com/users/github-actions%5Bbot%5D | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
echo "${{ steps.generate-hook-docs.outputs.hook-docs }}" > docs/Hooks.md | ||
git add docs/Hooks.md | ||
if git diff --cached --quiet; then | ||
echo "*No documentation changes to commit.*" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "*Committing documentation changes.*" >> $GITHUB_STEP_SUMMARY | ||
git commit -q -m "Update hooks documentation from ${{ github.head_ref }} branch." | ||
git push | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.