Skip to content

Commit 6883a9e

Browse files
committed
ci: add warning on release PRs
1 parent 721f6ee commit 6883a9e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/warn-release-pr.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Warn on Release Branch
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
warn-on-release-branch:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check if branch name starts with "release"
13+
id: check_branch
14+
run: |
15+
if [[ "${{ github.head_ref }}" == release* ]]; then
16+
echo "branch_is_release=true" >> $GITHUB_ENV
17+
else
18+
echo "branch_is_release=false" >> $GITHUB_ENV
19+
fi
20+
21+
- name: Post warning comment
22+
if: env.branch_is_release == 'true'
23+
uses: actions/github-script@v6
24+
with:
25+
script: |
26+
github.rest.issues.createComment({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
issue_number: context.payload.pull_request.number,
30+
body: "⚠️ Warning: PR should be **merged** and not **rebased**."
31+
})

0 commit comments

Comments
 (0)