Skip to content

Commit 1a19f1e

Browse files
committed
update workflow
1 parent b6fe267 commit 1a19f1e

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

.github/workflows/validate-readme.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111

1212
jobs:
1313
validate-readme:
14+
permissions:
15+
pull-requests: write
16+
contents: read
1417
runs-on: ubuntu-latest
1518
steps:
1619
- name: Checkout code
@@ -42,31 +45,23 @@ jobs:
4245
4346
- name: Comment on PR if README.md needs updating
4447
if: steps.check-diff.outputs.status == 'failure'
45-
uses: actions/github-script@v7
48+
uses: marocchino/sticky-pull-request-comment@v2
4649
with:
47-
github-token: ${{ secrets.GITHUB_TOKEN }}
48-
script: |
49-
const diff = `${{ steps.check-diff.outputs.diff }}`;
50-
const body = `## ⚠️ README.md needs to be updated
50+
header: readme-validation
51+
message: |
52+
## ⚠️ README.md needs to be updated
5153
52-
The \`update-readme.js\` script detected changes that need to be made to the README.md file.
54+
The `update-readme.js` script detected changes that need to be made to the README.md file.
5355
54-
Please run \`node update-readme.js\` locally and commit the changes before merging this PR.
56+
Please run `node update-readme.js` locally and commit the changes before merging this PR.
5557
5658
<details>
5759
<summary>View diff</summary>
5860
59-
\`\`\`diff
60-
${diff}
61-
\`\`\`
62-
</details>`;
63-
64-
github.rest.issues.createComment({
65-
owner: context.repo.owner,
66-
repo: context.repo.repo,
67-
issue_number: context.issue.number,
68-
body: body
69-
});
61+
```diff
62+
${{ steps.check-diff.outputs.diff }}
63+
```
64+
</details>
7065
7166
- name: Fail workflow if README.md needs updating
7267
if: steps.check-diff.outputs.status == 'failure'

0 commit comments

Comments
 (0)