@@ -25,28 +25,24 @@ runs:
2525 git config user.name "github-actions[bot]"
2626 git config user.email "github-actions[bot]@users.noreply.github.com"
2727
28- # Check if there are changes
29- git add ${{ inputs.file_paths }}
30- if [[ -z $(git status -s) ]]; then
31- echo "No changes to commit. Skipping PR creation."
32- exit 0
33- fi
28+ # Ensure we're on staging branch, not detached HEAD
29+ git fetch origin staging dev
30+ git checkout staging
3431
35- # Commit changes on temporary branch
36- git checkout -b temp-version-commit
37- git commit -m "chore: bump ${{ inputs.platform }} version for ${{ inputs.version }} [skip ci]"
32+ # Check if staging has commits not in dev (version bumps + any build changes)
33+ COMMITS_AHEAD=$(git rev-list --count origin/dev..staging)
3834
39- # Create new branch from dev
40- git fetch origin dev
41- git checkout -b ${BRANCH_NAME} origin/dev
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
4239
43- # Cherry-pick only the version changes
44- git cherry-pick temp-version-commit
40+ echo "📊 Staging is $COMMITS_AHEAD commit(s) ahead of dev"
4541
46- # Clean up temporary branch
47- git branch -D temp-version-commit
42+ # Create new branch from current staging (which has all version changes)
43+ git checkout -b ${BRANCH_NAME}
4844
49- # Push and create PR
45+ # Push the branch
5046 git push --set-upstream origin ${BRANCH_NAME}
5147
5248 # Determine PR title based on platform
6056 --base dev \
6157 --head ${BRANCH_NAME} \
6258 --title "$PR_TITLE" \
63- --body "Automated version bump by CI"
59+ --body "Automated version bump by CI" \
60+ --label "automated"
6461 env :
6562 GH_TOKEN : ${{ inputs.github_token }}
0 commit comments