mengw15 commented on code in PR #8378:
URL: https://github.com/apache/texera/pull/8378#discussion_r3922520855
##########
.github/workflows/direct-backport-push.yml:
##########
@@ -1059,11 +1115,131 @@ jobs:
// backport" signal visible on main next to the successful ones.
try {
await github.rest.repos.createCommitStatus({
- owner, repo, sha: MERGE_SHA, state: "failure",
+ owner, repo, sha: MERGE_SHA,
+ // A clean backport is on its way, not stuck: only the ones
+ // needing hands carry the red "needs backport" signal on main.
+ state: clean ? "success" : "failure",
context: `backport/${TARGET_BRANCH}`,
- description: `Draft backport PR #${pr.number} opened`,
+ description: clean
+ ? `Backport PR #${pr.number} open, auto-merge armed`
Review Comment:
You are right, and this is the same mistake in a second place — I had
already added a comment correcting the auto-merge claim if arming failed, then
left the commit status claiming success before either operation ran. Fixed in
`e47d2133e`: the opening step now writes `pending` with "starting its checks",
and the close/reopen step settles it on every path — `success` once auto-merge
is armed, `failure` with "needs reopening" if the reopen is lost, `failure`
with "merge it by hand" if only the arming fails.
##########
.github/workflows/direct-backport-push.yml:
##########
@@ -990,9 +1036,15 @@ jobs:
pr = (await github.rest.pulls.create({
owner, repo, base: TARGET_BRANCH, head: BRANCH,
- title, body, draft: true,
+ title, body, draft: !clean,
Review Comment:
Fixed in `e47d2133e`. The idempotency branch returned the existing PR
untouched, so a re-run kept whatever draft state the previous one produced: a
now-clean backport stranded as a draft, which auto-merge cannot be armed on, or
a now-conflicted one still ready for review with markers in it. It now
reconciles the state first, via `markPullRequestReadyForReview` /
`convertPullRequestToDraft` since REST cannot toggle draft.
##########
.github/workflows/direct-backport-push.yml:
##########
@@ -1059,11 +1115,131 @@ jobs:
// backport" signal visible on main next to the successful ones.
try {
await github.rest.repos.createCommitStatus({
- owner, repo, sha: MERGE_SHA, state: "failure",
+ owner, repo, sha: MERGE_SHA,
+ // A clean backport is on its way, not stuck: only the ones
+ // needing hands carry the red "needs backport" signal on main.
+ state: clean ? "success" : "failure",
context: `backport/${TARGET_BRANCH}`,
- description: `Draft backport PR #${pr.number} opened`,
+ description: clean
+ ? `Backport PR #${pr.number} open, auto-merge armed`
+ : `Draft backport PR #${pr.number} opened`,
target_url: prUrl,
});
} catch (e) {
core.warning(`Could not set commit status: ${e.message}`);
}
+
+ // Handed to the step below, which starts this PR's checks and arms
+ // auto-merge — both need a token that can trigger workflows.
+ if (clean) core.setOutput("clean_pr", String(pr.number));
+
+ # GitHub suppresses workflow runs for anything GITHUB_TOKEN does, so the
+ # pull request opened above starts with no checks at all. A conflicted
one
+ # does not care: it is a draft, and CI fires when its author pushes a
+ # resolution. A clean one has nobody to push anything, so its three
+ # required contexts would never appear and auto-merge would wait on them
+ # forever — the backport would look like it was progressing while sitting
+ # still.
+ #
+ # Closing and reopening it under a token that can trigger workflows emits
+ # `pull_request: reopened`, which Required Checks, Check License Headers
+ # and Validate PR title all subscribe to. The pull request keeps
+ # github-actions[bot] as its author; only these two events carry the
+ # token owner's name.
+ - name: Start checks and arm auto-merge
+ if: ${{ matrix.clean == 'true' && steps.open.outputs.clean_pr }}
+ uses: actions/github-script@v9
+ env:
+ CLEAN_PR: ${{ steps.open.outputs.clean_pr }}
+ ORIGINAL_PR: ${{ matrix.pr_number }}
+ TARGET_BRANCH: ${{ matrix.target }}
+ with:
+ github-token: ${{ secrets.AUTO_MERGE_TOKEN || secrets.GITHUB_TOKEN }}
Review Comment:
Fixed in `e47d2133e` — the fallback is gone, `github-token: ${{
secrets.AUTO_MERGE_TOKEN }}` with a comment saying why there is no `||
secrets.GITHUB_TOKEN`. You have named the exact failure the fallback would
produce: this step exists only to emit an event GITHUB_TOKEN cannot emit, so
falling back to it would report success on a backport whose required contexts
were never created. Failing on a missing secret is the correct direction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]