44 lines
2.2 KiB
YAML
44 lines
2.2 KiB
YAML
name: Contributor Check
|
|
on:
|
|
# ATTENTION: See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
|
# re security implications of using this trigger; in particular, no code from PR branches must
|
|
# be executed in any flows triggered by it
|
|
pull_request_target:
|
|
branches:
|
|
- main
|
|
- 1.*
|
|
- 2.*
|
|
types: [ opened ]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check if COPYRIGHT.txt has author name?
|
|
id: check
|
|
env:
|
|
pull_request_number: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
curl -H 'Accept: application/vnd.github.v3.raw' https://raw.githubusercontent.com/debezium/debezium/main/COPYRIGHT.txt >> COPYRIGHT.txt
|
|
curl -H 'Accept: application/vnd.github.v3.raw' https://raw.githubusercontent.com/debezium/debezium/main/jenkins-jobs/scripts/config/Aliases.txt >> ALIASES.txt
|
|
curl -H 'Accept: application/vnd.github.v3.raw' https://raw.githubusercontent.com/debezium/debezium/main/jenkins-jobs/scripts/config/FilteredNames.txt >> FILTEREDNAMES.txt
|
|
|
|
curl --silent -X "GET" https://api.github.com/repos/debezium/debezium/pulls/$pull_request_number/commits | jq '.[] | {author: .commit.author.name}' | jq -r '.author' | uniq >> AUTHOR_NAME.txt
|
|
|
|
while IFS=" " read -r AUTHOR;
|
|
do
|
|
if ! grep -qi "$AUTHOR" COPYRIGHT.txt; then
|
|
if ! grep -qi "$AUTHOR" ALIASES.txt; then
|
|
if ! grep -qi "$AUTHOR" FILTEREDNAMES.txt; then
|
|
echo "::set-output name=NOT_FOUND::true"
|
|
fi
|
|
fi
|
|
fi
|
|
done < AUTHOR_NAME.txt
|
|
- name: Create comment
|
|
if: ${{ steps.check.outputs.NOT_FOUND == 'true' }}
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
body: |
|
|
Welcome as a new contributor to Debezium, @${{ github.event.pull_request.user.login }}. Reviewers, please add missing author name(s) and alias name(s) to the [COPYRIGHT.txt](https://github.com/debezium/debezium/blob/main/COPYRIGHT.txt) and [Aliases.txt](https://github.com/debezium/debezium/blob/main/jenkins-jobs/scripts/config/Aliases.txt) respectively.
|