auto create develop branch too

This commit is contained in:
quotentiroler
2026-02-06 20:36:23 -08:00
parent ae5afafd75
commit f1041cf773

View File

@@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true
permissions:
contents: read
contents: write
pull-requests: write
jobs:
@@ -28,23 +28,15 @@ jobs:
with:
fetch-depth: 0
- name: Check if develop exists
id: check-develop
- name: Ensure develop branch exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if git ls-remote --heads origin develop | grep -q develop; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "develop branch already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "::warning::develop branch does not exist yet. PR will target main."
fi
- name: Determine target branch
id: target
run: |
if [ "${{ steps.check-develop.outputs.exists }}" = "true" ]; then
echo "branch=develop" >> $GITHUB_OUTPUT
else
echo "branch=main" >> $GITHUB_OUTPUT
echo "develop branch does not exist — creating from main"
git push origin origin/main:refs/heads/develop
fi
- name: Check for existing PR
@@ -53,7 +45,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="${{ github.ref_name }}"
TARGET="${{ steps.target.outputs.branch }}"
TARGET="develop"
# Check if PR already exists
EXISTING=$(gh pr list --head "$BRANCH" --base "$TARGET" --json number --jq '.[0].number // empty')
@@ -72,7 +64,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="${{ github.ref_name }}"
TARGET="${{ steps.target.outputs.branch }}"
TARGET="develop"
# Extract title from branch name (dev/foo-bar → foo bar)
TITLE=$(echo "$BRANCH" | sed 's|^dev/||; s|^feature/||; s|^fix/||; s|-| |g; s|_| |g')