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