Skip to content

Commit d1cb6f8

Browse files
authored
Add workflow to prevent merging from badges branch
1 parent 6183374 commit d1cb6f8

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/badges.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Prevent merging `badges` branch
5+
6+
on:
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
jobs:
11+
check_source_branch:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Ensure source branch is not badges
15+
run: |
16+
SOURCE_BRANCH="${{ github.head_ref }}"
17+
RESTRICTED_BRANCH="badges"
18+
19+
if [ "$SOURCE_BRANCH" == "$RESTRICTED_BRANCH" ]; then
20+
echo "Error: Merging from '$RESTRICTED_BRANCH' into 'main' is not allowed."
21+
exit 1
22+
fi

0 commit comments

Comments
 (0)