Files
coffeechat/.github/workflows/prevent-readme-pr.yml
2024-04-29 11:26:28 -04:00

31 lines
1.2 KiB
YAML

name: Prevent README commits
on:
pull_request:
paths:
- 'README.md'
jobs:
check-for-readme-commit:
runs-on: ubuntu-latest
if: ${{ github.actor != 'actions-user' }}
steps:
- name: Fail this PR
uses: actions/github-script@v7.0.1
if: ${{ github.event.head_commit.committer.username != 'actions-user' }}
with:
script: |
core.setFailed('Do not make changes in README.md directly. Update people.json: more information in CONTRIBUTING.md.')
- name: Add comment for the user
if: always()
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](https://github.com/fharper/coffeechat/blob/main/people.json): more information in [CONTRIBUTING.md](https://github.com/fharper/coffeechat/blob/main/CONTRIBUTING.md).'
})