|
| 1 | +name: Create Version Bump PR |
| 2 | +description: Creates a PR from staging changes onto dev branch |
| 3 | +inputs: |
| 4 | + platform: |
| 5 | + description: Platform name (ios or android) |
| 6 | + required: true |
| 7 | + version: |
| 8 | + description: Current version string |
| 9 | + required: true |
| 10 | + file_paths: |
| 11 | + description: File paths to include in the PR (newline separated) |
| 12 | + required: true |
| 13 | + github_token: |
| 14 | + description: GitHub token for creating PR |
| 15 | + required: true |
| 16 | + |
| 17 | +runs: |
| 18 | + using: composite |
| 19 | + steps: |
| 20 | + - name: Create version bump PR |
| 21 | + shell: bash |
| 22 | + run: | |
| 23 | + BRANCH_NAME="ci/bump-${{ inputs.platform }}-build-${{ github.run_id }}" |
| 24 | +
|
| 25 | + git config user.name "github-actions[bot]" |
| 26 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 27 | +
|
| 28 | + # Ensure we're on staging branch, not detached HEAD |
| 29 | + git fetch origin staging dev |
| 30 | + git checkout staging |
| 31 | +
|
| 32 | + # Check if staging has commits not in dev (version bumps + any build changes) |
| 33 | + COMMITS_AHEAD=$(git rev-list --count origin/dev..staging) |
| 34 | +
|
| 35 | + if [ "$COMMITS_AHEAD" -eq 0 ]; then |
| 36 | + echo "ℹ️ No new commits on staging compared to dev. Skipping PR creation." |
| 37 | + exit 0 |
| 38 | + fi |
| 39 | +
|
| 40 | + echo "📊 Staging is $COMMITS_AHEAD commit(s) ahead of dev" |
| 41 | +
|
| 42 | + # Create new branch from current staging (which has all version changes) |
| 43 | + git checkout -b ${BRANCH_NAME} |
| 44 | +
|
| 45 | + # Push the branch |
| 46 | + git push --set-upstream origin ${BRANCH_NAME} |
| 47 | +
|
| 48 | + # Determine PR title based on platform |
| 49 | + if [ "${{ inputs.platform }}" = "mobile" ]; then |
| 50 | + PR_TITLE="chore: bump mobile app version to ${{ inputs.version }}" |
| 51 | + else |
| 52 | + PR_TITLE="chore: bump ${{ inputs.platform }} build for ${{ inputs.version }}" |
| 53 | + fi |
| 54 | +
|
| 55 | + gh pr create \ |
| 56 | + --base dev \ |
| 57 | + --head ${BRANCH_NAME} \ |
| 58 | + --title "$PR_TITLE" \ |
| 59 | + --body "Automated version bump by CI" \ |
| 60 | + --label "automated" |
| 61 | + env: |
| 62 | + GH_TOKEN: ${{ inputs.github_token }} |
0 commit comments