Skip to content

Close issues on development from the merge push, forks included - #804

Merged
BattermanZ merged 1 commit into
developmentfrom
fix/close-issues-fork-prs
Nov 25, 2026
Merged

BattermanZ merged 1 commit into
developmentfrom
fix/close-issues-fork-prs

Conversation

@BattermanZ

Copy link
Copy Markdown
Member

Closes #800

Summary

 on:
-  pull_request: [closed] → development     # fork PRs get a read-only token
+  push: development                         # the merge's own push, write token, fork or not

 job
-  if PR merged
-    close issues named by this PR
+  for each merge commit in the push (two parents)
+    PR = merged pull request whose merge_commit_sha is that commit
+         (newest merge retried once after 15 s if GitHub has not linked it yet)
+    close issues named by PR              # same parsing, skips and comment as before
+  one failed read or close no longer stops the rest; the run still ends failed

The brief proposed pull_request_target. GitHub blocks it by default in public repositories from 2 December 2026 and reads it from main, so it would do nothing until a release and then stop. The maintainer chose the push route instead; the brief's acceptance criteria are revised on #800.

permissions: gains contents: read, which the compare API needs to list a push's commits.

Evidence

  • Before: run 45396721087 for fork PR Let Cloudflare Access callbacks reach the network #799 failed at gh issue close with Resource not accessible by integration; Service worker intercepts the Cloudflare Access sign-in return #798 stayed open.
    After: the lookup run read-only against the real merges: push 6830beb^1...4149c7a → merge commits 6830beb, 4149c7a → PRs 797 (branch) and 799 (fork) → Closes #798 found.
  • The run script, executed against a fake gh: an inner merge with no PR is skipped without waiting, a failed close of one issue does not stop the next PR's close, a failed PR read is reported and skipped, the newest merge retries once, and the exit code is 1 when anything failed.
  • actionlint clean; just check passed.

Merge Danger

Door: two-way

Revert the commit to get the old trigger back.

Blast Radius: CI-only

If the new trigger misbehaves, issues named by merged PRs stay open until closed by hand, as #798 was. Merging this PR is itself the same-repository test: #800 should close with "Closed by #N".

🤖 Generated with Claude Code

https://claude.ai/code/session_013rPDLeUbZ9VvUn18RPRPQV

The workflow ran on `pull_request: closed`, which gives a fork's pull
request a read-only token, so #799's merge could not close #798. The
`pull_request_target` route in the brief is blocked by default in public
repositories from 2 December 2026 and reads its workflow from `main`, so
the workflow now runs on the push a merge makes to `development`, maps
each merge commit to its pull request through the API, and closes the
issues that pull request names as before. One failure no longer stops
the other pull requests in the same push.

Closes #800

Changelog: none, CI workflow only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013rPDLeUbZ9VvUn18RPRPQV
@BattermanZ
BattermanZ merged commit 890915c into development Nov 25, 2026
@BattermanZ
BattermanZ deleted the fix/close-issues-fork-prs branch November 25, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant