Skip to content

2.5.0 patches

2.5.0 patches #47

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 "USER_NOT_FOUND=true" >> $GITHUB_OUTPUT
fi
fi
fi
done < AUTHOR_NAME.txt
- name: Create comment
if: ${{ steps.check.outputs.USER_NOT_FOUND == 'true' }}
uses: peter-evans/create-or-update-comment@v3
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.
- name: Check failure
if: ${{ steps.check.outputs.USER_NOT_FOUND == 'true' }}
uses: actions/github-script@v7
continue-on-error: false
with:
script: |
throw new Error('Add new user, @${{ github.event.pull_request.user.login }} to COPYRIGHT.txt and Aliases.txt')