From 2a7753fb94af5b052869fffd9e2e52aa621050f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Harper?= Date: Mon, 29 Apr 2024 11:11:42 -0400 Subject: [PATCH] add comment when commit directly in README.md + fix error message --- .github/workflows/prevent-readme-pr.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prevent-readme-pr.yml b/.github/workflows/prevent-readme-pr.yml index 36b48a4..ccdb387 100644 --- a/.github/workflows/prevent-readme-pr.yml +++ b/.github/workflows/prevent-readme-pr.yml @@ -9,9 +9,21 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor != 'actions-user' }} steps: + - name: Fail this PR uses: actions/github-script@v3 if: ${{ github.event.head_commit.committer.username != 'actions-user' }} with: script: | - core.setFailed('Do not make changes in README.md directly! Update TEMPLATE_README.md in the scripts folder instead.') + core.setFailed('Do not make changes in README.md directly. Update people.json: more information in CONTRIBUTING.md.') + + - name: Add comment for the user + uses: actions/github-script@v7.0.1 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Do not make changes in README.md directly. Update [people.json](people.json): more information in [CONTRIBUTING.md)(CONTRIBUTING.md).' + })