Skip to content

Commit

Permalink
update branch check
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-sindri committed Oct 27, 2024
1 parent 8cf34a8 commit ce8d493
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ jobs:
- name: Branch Check
if: ${{ github.event_name == 'release' && github.event.release.prerelease == false }}
run: |
if [[ "$GITHUB_REF_PROTECTED" == 'false' ]]; then
echo "Releases can only be created from a protected branch"
git fetch origin main
git checkout main
set +e
mains=$(git branch --contains $sha | grep -E "(^|\s)main$")
set -e
echo "Mains: $mains"
if [ -z "$mains" ]; then
echo "Releases can only be created from main"
exit 1
fi
Expand Down

0 comments on commit ce8d493

Please sign in to comment.