diff --git a/.github/workflows/reusable-release-pr.yml b/.github/workflows/reusable-release-pr.yml index 107c5677..8ddd3efe 100644 --- a/.github/workflows/reusable-release-pr.yml +++ b/.github/workflows/reusable-release-pr.yml @@ -30,10 +30,17 @@ jobs: --head staging \ --state open \ --json number | jq 'length') + COMPARE_URL="repos/${GITHUB_REPOSITORY}/compare/main...staging" + TOTAL_COMMITS=$(gh api "$COMPARE_URL?per_page=1" --jq '.total_commits // 0') echo "existing=$EXISTING" >> "$GITHUB_OUTPUT" + echo "commits=$TOTAL_COMMITS" >> "$GITHUB_OUTPUT" + + - name: No changes + if: steps.check-pr.outputs.existing == '0' && steps.check-pr.outputs.commits == '0' + run: echo 'staging is already aligned with main; no promotion PR is needed.' - name: Create - if: steps.check-pr.outputs.existing == '0' + if: steps.check-pr.outputs.existing == '0' && steps.check-pr.outputs.commits != '0' run: | DATE=$(date +%Y-%m-%d) BODY_FILE="$RUNNER_TEMP/release-pr.md"