Skip to content

Commit a1d1f79

Browse files
authored
feat(ci): Add workflow to automate release branch creation (#1092)
Prevent workflow execution from non-default branches.
1 parent b925d17 commit a1d1f79

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/create-release-branch.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ jobs:
2626
name: Validate permissions
2727
runs-on: ubuntu-latest
2828
steps:
29+
- name: Check default branch
30+
env:
31+
REF: ${{ github.ref_name }}
32+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
33+
run: |
34+
if [ "$REF" != "$DEFAULT_BRANCH" ]; then
35+
echo "::error::This workflow can only be run from the default branch (${DEFAULT_BRANCH}), but was triggered from '${REF}'."
36+
exit 1
37+
fi
38+
2939
- name: Check admin permission
3040
env:
3141
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)