Skip to content

ci(verify-pr): enable fork-PR dispatch via pull_request_target + ok-to-test - #306

Merged
mrizzi merged 1 commit into
verify-pr-fullsendfrom
TC-6331
Sep 17, 2026
Merged

mrizzi merged 1 commit into
verify-pr-fullsendfrom
TC-6331

Conversation

@mrizzi

@mrizzi mrizzi commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enables fullsend-verify-pr.yml to dispatch on fork-origin PRs by switching the trigger from pull_request to pull_request_target (fullsend ADR-0009). A pull_request run on a fork head gets no upstream vars/secrets/OIDC, so the mint step failed with FULLSEND_MINT_URL is not set; pull_request_target runs the base-branch workflow with full credential access.

Safety is preserved by not checking out or executing fork code — the workflow builds the dispatch matrix from github.event alone and hands off to reusable-dispatch.yml (which does its own checkout/mint in base-repo context).

Defense-in-depth: an ok-to-test maintainer-label gate.

  • Same-repo (upstream) PRs need no label; run on opened/synchronize/reopened.
  • Fork PRs dispatch only when a maintainer applies ok-to-test.
  • The remove-ok-to-test job strips the label on every new push to a fork PR, forcing re-review.

Changes

  • .github/workflows/fullsend-verify-pr.ymlpull_request_target trigger (+labeled); ok-to-test gate on wait-for-checks; new remove-ok-to-test job.
  • fullsend.md — new Fork PRs subsection documenting the model; obsolete "upstream head branch required" framing removed/annotated.

Verification

Implements TC-6331

🤖 Generated with Claude Code

Summary by Sourcery

Enable safe verification dispatches for fork pull requests with maintainer approval while retaining automatic verification for same-repository changes.

New Features:

  • Enable verification dispatches for fork-origin pull requests through the base-branch workflow.
  • Require an ok-to-test maintainer label before running verification for fork pull requests, with the label removed after new commits.

Bug Fixes:

  • Fix fork pull request verification failures caused by unavailable upstream variables, secrets, and OIDC credentials.

Enhancements:

  • Preserve credential safety by avoiding checkout or execution of pull request code and document the fork pull request workflow and review model.

CI:

  • Update verification workflow triggers and gating to support fork pull requests while retaining automatic runs for same-repository pull requests.

Documentation:

  • Document the pull_request_target security model, maintainer-label approval flow, and removal of the former upstream-branch requirement.

…o-test

Switch fullsend-verify-pr.yml from pull_request to pull_request_target so
fork-origin PRs get the upstream vars/secrets/OIDC the mint step needs (fixes
"FULLSEND_MINT_URL is not set"; fullsend ADR-0009). The workflow still never
checks out or executes fork code — it builds the dispatch matrix from
github.event alone and hands off to reusable-dispatch.yml.

Add an ok-to-test maintainer-label gate as defense-in-depth: fork PRs dispatch
only after a maintainer applies the label; the remove-ok-to-test job strips it
on every new push (synchronize) to force re-review. Same-repo PRs are unchanged.

Update fullsend.md with the pull_request_target + ok-to-test model and remove
the obsolete "upstream head branch required" framing.

Implements TC-6331

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The PR enables verify-pr dispatches for fork-origin pull requests by using pull_request_target and upstream credentials, while avoiding fork-code execution and requiring maintainer-controlled ok-to-test approval that is removed after new commits; documentation is updated accordingly.

Sequence diagram for gated fork PR verification dispatch

sequenceDiagram
    actor Maintainer
    participant GitHub as GitHub pull_request_target
    participant Verify as fullsend-verify-pr.yml
    participant Dispatch as reusable-dispatch.yml
    participant Fullsend as Fullsend service

    GitHub->>Verify: pull_request_target opened/reopened
    Verify->>Verify: wait-for-checks
    Verify->>Dispatch: dispatch matrix from github.event
    Dispatch->>Fullsend: mint and run verify-pr

    Maintainer->>GitHub: Apply ok-to-test label
    GitHub->>Verify: pull_request_target labeled
    Verify->>Verify: wait-for-checks
    Verify->>Dispatch: dispatch matrix from github.event
    Dispatch->>Fullsend: mint and run verify-pr
Loading

File-Level Changes

Change Details Files
Switch fork-capable verification dispatch to a privileged base-context trigger while preserving the no-fork-code-execution invariant.
  • Replace pull_request with pull_request_target and add labeled events.
  • Continue deriving the dispatch matrix from event metadata without checking out PR head code.
  • Document the credential/OIDC rationale and safety model.
.github/workflows/fullsend-verify-pr.yml
fullsend.md
Add maintainer approval gating and automatic invalidation for fork pull requests.
  • Allow upstream PRs to run without a label, while requiring ok-to-test on fork PRs.
  • Start fork verification when the label is applied.
  • Remove ok-to-test on every new fork-PR push using a base-context GitHub Script job with label-write permission.
.github/workflows/fullsend-verify-pr.yml
fullsend.md
Update operational documentation to reflect the new fork-PR workflow and remove the former upstream-head limitation.
  • Add the pull_request_target and ok-to-test operating model.
  • Annotate historical upstream-only E2E examples as pre-change constraints.
fullsend.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. This changes the workflow trust boundary so fork-controlled pull requests can trigger base-branch code with upstream secrets and OIDC credentials. If the event-data or reusable-workflow handoff permits credential exfiltration or an unauthorized dispatch, credentials or access could be exposed outside the repository and reverting would not undo that exposure.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@mrizzi
mrizzi merged commit 3f3b621 into verify-pr-fullsend Sep 17, 2026
17 checks passed
@mrizzi
mrizzi deleted the TC-6331 branch September 17, 2026 13:45
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