Skip to content

Commit

Permalink
Check the CONTRIBUTORS.md file. (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker committed Jan 2, 2024
1 parent 17c69ab commit 7597f43
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Check CONTRIBUTORS.md"

on:
pull_request:
branches:
- main

jobs:
check-contributors:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check PR author in CONTRIBUTORS.md
run: |
pr_author=$(jq -r .pull_request.user.login "$GITHUB_EVENT_PATH")
pattern="(@$pr_author)"
contributors=$(grep -Eo "$pattern" CONTRIBUTORS.md || true)
if [ -z "$contributors" ]; then
echo "PR author ($pr_author) not found in CONTRIBUTORS.md"
exit 1
else
echo "PR author ($pr_author) found in CONTRIBUTORS.md"
fi

0 comments on commit 7597f43

Please sign in to comment.