diff --git a/.github/workflows/integration-batch.yml b/.github/workflows/integration-batch.yml index eac45447d..8b6086a0b 100644 --- a/.github/workflows/integration-batch.yml +++ b/.github/workflows/integration-batch.yml @@ -192,6 +192,7 @@ jobs: npm test - name: Create or update PR integration -> main + id: integration_pr if: ${{ steps.dryrun.outputs.dry_run != 'true' }} env: GH_TOKEN: ${{ github.token }} @@ -242,8 +243,30 @@ jobs: existing="$(gh pr list --repo "$REPO" --state open --head integration --base main --json number --jq '.[0].number // empty')" if [ -n "$existing" ]; then gh pr edit "$existing" --repo "$REPO" --title "integration" --body "$body" + integration_pr_number="$existing" else - gh pr create --repo "$REPO" --head integration --base main --title "integration" --body "$body" + created_pr_url="$(gh pr create --repo "$REPO" --head integration --base main --title "integration" --body "$body")" + integration_pr_number="$(gh pr view "$created_pr_url" --repo "$REPO" --json number --jq '.number')" + fi + + if [ -z "$integration_pr_number" ]; then + echo "Failed to determine integration PR number" >&2 + exit 1 + fi + echo "number=$integration_pr_number" >> "$GITHUB_OUTPUT" + + - name: Label integration PR for snapshot review + if: ${{ steps.dryrun.outputs.dry_run != 'true' }} + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + run: | + snapshot_updates='${{ steps.merge.outputs.snapshot_updates }}' + integration_pr_number='${{ steps.integration_pr.outputs.number }}' + snapshot_file_count="$(echo "$snapshot_updates" | jq -r '(.files // []) | length' 2>/dev/null || echo 0)" + + if [ "$snapshot_file_count" -gt 0 ]; then + gh pr edit "$integration_pr_number" --repo "$REPO" --add-label integration-needs-snapshot-review || true fi - name: Job summary diff --git a/docs/INTEGRATION.md b/docs/INTEGRATION.md index f15e4559a..1cd62181e 100644 --- a/docs/INTEGRATION.md +++ b/docs/INTEGRATION.md @@ -7,6 +7,7 @@ The [`integration-batch` workflow](../.github/workflows/integration-batch.yml) a - `integration-batch`: PR is queued for integration batching. - `integrated`: PR was successfully merged into the `integration` branch by automation. - `integration-failed`: automation attempted integration but hit a merge conflict. +- `integration-needs-snapshot-review`: applied to the generated `integration -> main` PR when snapshot auto-recovery updates snapshot files. ## Selection rules