fixing validation workflow

This commit is contained in:
Aaron Powell 2025-10-20 10:00:10 +11:00
parent 33cab830b6
commit 48c5b1b6aa

View File

@ -33,51 +33,51 @@ jobs:
- name: Update README.md - name: Update README.md
run: node update-readme.js run: node update-readme.js
- name: Check for README.md changes - name: Check for file changes
id: check-diff id: check-diff
run: | run: |
if git diff --exit-code README.md; then if git diff --exit-code; then
echo "No changes to README.md after running update script." echo "No changes detected after running update script."
echo "status=success" >> $GITHUB_OUTPUT echo "status=success" >> $GITHUB_OUTPUT
else else
echo "Changes detected in README.md after running update script." echo "Changes detected after running update script."
echo "status=failure" >> $GITHUB_OUTPUT echo "status=failure" >> $GITHUB_OUTPUT
echo "diff<<EOF" >> $GITHUB_OUTPUT echo "diff<<EOF" >> $GITHUB_OUTPUT
git diff README.md >> $GITHUB_OUTPUT git diff >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
fi fi
- name: Output diff to logs for non-write users - name: Output diff to logs for non-write users
if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push != true if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push != true
run: | run: |
echo "::group::README.md diff (changes needed)" echo "::group::File changes (changes needed)"
echo "The following changes need to be made to README.md:" echo "The following changes need to be made:"
echo "" echo ""
git diff README.md git diff
echo "::endgroup::" echo "::endgroup::"
- name: Comment on PR if README.md needs updating - name: Comment on PR if files need updating
if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push == true if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push == true
uses: marocchino/sticky-pull-request-comment@v2 uses: marocchino/sticky-pull-request-comment@v2
with: with:
header: readme-validation header: readme-validation
message: | message: |
## ⚠️ README.md needs to be updated ## ⚠️ Generated files need to be updated
The `update-readme.js` script detected changes that need to be made to the README.md file. The `update-readme.js` script detected changes that need to be made.
Please run `node update-readme.js` locally and commit the changes before merging this PR. Please run `node update-readme.js` locally and commit the changes before merging this PR.
<details> <details>
<summary>View diff</summary> <summary>View diff</summary>
```diff ```diff
${{ steps.check-diff.outputs.diff }} ${{ steps.check-diff.outputs.diff }}
``` ```
</details> </details>
- name: Fail workflow if README.md needs updating - name: Fail workflow if files need updating
if: steps.check-diff.outputs.status == 'failure' if: steps.check-diff.outputs.status == 'failure'
run: | run: |
echo "❌ README.md needs to be updated. Please run 'node update-readme.js' locally and commit the changes." echo "❌ Generated files need to be updated. Please run 'node update-readme.js' locally and commit the changes."
exit 1 exit 1