From e6eeb2bb659dcda5de23e2e03b6e0a5560439a49 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 5 Jun 2021 23:06:04 -0400 Subject: [PATCH] [all] check if pull request author is in AUTHORS --- .github/workflows/pr-check.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 00000000..353a59db --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,18 @@ +name: pr-check +on: pull_request +jobs: + authors: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Check AUTHORS file + run: | + user="$(curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -s https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} | jq -r .user.login)" + echo "Checking if GitHub user $user is in AUTHORS file..." + if grep -q -E '> \('"$user"'\)' AUTHORS; then + echo "$user found in AUTHORS file, all good!" + else + echo "$user not found in AUTHORS file." + echo "Please add yourself to the AUTHORS file and try again." + exit 1 + fi