update workflow

This commit is contained in:
Aaron Powell 2025-07-02 19:21:48 +10:00
parent b6fe26796a
commit 1a19f1e266

View File

@ -11,6 +11,9 @@ on:
jobs:
validate-readme:
permissions:
pull-requests: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -42,31 +45,23 @@ jobs:
- name: Comment on PR if README.md needs updating
if: steps.check-diff.outputs.status == 'failure'
uses: actions/github-script@v7
uses: marocchino/sticky-pull-request-comment@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const diff = `${{ steps.check-diff.outputs.diff }}`;
const body = `## ⚠️ README.md needs to be updated
header: readme-validation
message: |
## ⚠️ README.md needs 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 to the README.md file.
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>
<summary>View diff</summary>
\`\`\`diff
${diff}
\`\`\`
</details>`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
```diff
${{ steps.check-diff.outputs.diff }}
```
</details>
- name: Fail workflow if README.md needs updating
if: steps.check-diff.outputs.status == 'failure'