Skip to content

Re-fetch PR in require-linear so re-runs see current labels/body - #3

Merged
Ryan Zhu (underthestars-zhy) merged 1 commit into
mainfrom
claude/require-linear-refetch-pr
Oct 7, 2026
Merged

Ryan Zhu (underthestars-zhy) merged 1 commit into
mainfrom
claude/require-linear-refetch-pr

Conversation

@claude

@claude claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Ryan Zhu · Slack thread

Before: if you added no-linear or fixed the description and then clicked "Re-run jobs", the check still failed. The re-run reused the event payload saved when the PR was opened, so the check never saw the change. For example, photon-hq/macrocosm-astrolabe#68 has the no-linear label, but its re-run (attempt 2) still failed.

After: the check reads the PR's current state from the API. A re-run now sees the labels, title, description and author as they are at that moment.

How: after the existing no-payload guard, the script now calls github.rest.pulls.get({ owner, repo, pull_number: payloadPr.number }). Every later step uses that result as pr, so nothing reads the event payload anymore. const { owner, repo } = context.repo moves up next to the guard, and the duplicate line further down is removed. The existing pull-requests: read permission is enough. The merge_group pass still returns before the fetch.

I tested this locally by pulling the script out of the YAML and running it with fake context/core/github objects. The test is not committed.

  • Stale payload, current state differs:
    • Payload has no label, but the current PR has no-linear added by a maintainer: passes through the label path.
    • The same label added by a user with write access: fails.
    • Payload description is empty, current description is "Fixes ENG-1": passes.
    • Payload description is "Fixes ENG-1", current description is empty: fails.
    • Current title is "ENG-5 foo": passes.
  • Existing cases, all passing or failing as before: the magic-word cases, the bare-id cases, the linkback comment from linear-code[bot] versus the same text from another user, and the bot allowlist.
  • Fetch: pulls.get is called exactly once with the right owner, repo and PR number.
  • merge_group: still passes without calling pulls.get.

All 20 cases behaved as expected. actionlint v1.7.12 reports nothing, and the file parses as YAML.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NsMkr3BJgeq2SmvvuV6cdg


Generated by Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

"Re-run jobs" replays the original event payload, so a no-linear label
or description fix added after the PR opened was invisible to the
check (macrocosm-astrolabe#68). Fetch the PR with pulls.get and check
that instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NsMkr3BJgeq2SmvvuV6cdg
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b571a253-75f5-4bb3-865f-b4b46a5dc98f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@underthestars-zhy
Ryan Zhu (underthestars-zhy) merged commit 68186df into main Oct 7, 2026
2 checks passed
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.

2 participants