Updated workflow

This commit is contained in:
Hugo Bernier 2024-10-28 11:17:55 -05:00 committed by GitHub
parent 68af4c4e57
commit 396d6981ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
name: Prevent Sic-Main to Main Merge
name: Prevent SIC-Main to Main Merge # SIC-main is only used for Sharing is Caring sessions
on:
pull_request:
types: [opened, synchronize]
@ -9,7 +9,19 @@ jobs:
steps:
- name: Check branch names
if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref == 'sic-main'
run: exit 1
run: |
# Post a comment on the PR
curl -s -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"body": "Merging from `sic-main` to `main` is not allowed. This pull request will be automatically closed."}' \
"${{ github.event.pull_request.url }}/comments"
# Close the PR
curl -s -X PATCH -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}' \
"${{ github.event.pull_request.url }"
env:
PR_SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }}
PR_TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}