Update recipe_list.json #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Pull Request Approval | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
paths: | |
- 'modifier/**' | |
- 'data/**' | |
- 'changelogs/**' | |
jobs: | |
auto-approve-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Check username | |
id: check_user | |
run: | | |
AUTHOR="${{ github.event.pull_request.user.login }}" | |
ALLOWED_USERS="EternityTQ, Cre-epbee, tankofpacer" | |
echo "ALLOWED=false" >> $GITHUB_ENV | |
if [[ $ALLOWED_USERS =~ (^|[[:space:]])$AUTHOR($|[[:space:]]) ]]; then | |
echo "ALLOWED=true" >> $GITHUB_ENV | |
fi | |
- name: Auto approve pull request | |
if: env.ALLOWED == 'true' | |
run: | | |
curl -X POST -H "Authorization: token ${{ secrets.NORI_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \ | |
-d '{"event":"APPROVE"}' | |
- name: Merge pull request | |
if: env.ALLOWED == 'true' | |
run: | | |
curl -X PUT -H "Authorization: token ${{ secrets.NORI_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge \ | |
-d '{"commit_title":"Automatically merged by GitHub Actions","commit_message":"Merging approved changes","merge_method":"merge"}' |