Skip to content

protected-safety-review always fails on pull_request_target: GITHUB_SHA is base, not PR head #2229

Done

Description

@abrichr

In scripts/ci/protected_safety_review.py, _current_run_errors compares workflow_run.head_sha with workflow_sha, which is GITHUB_SHA. On pull_request_target, GITHUB_SHA is the last commit on the base branch, but the run's head_sha is the PR head. So every pull_request_target run fails with "workflow run SHA does not match the triggering event SHA".

Examples: run 43228654349 on #2225 (attempt 2) and the #2228 runs.

Only issue_comment runs pass, because there both values are main. Today that means a PR needs a comment before it can merge.

Fix: on pull_request_target, compare against the run's base SHA (the TRUSTED_BASE_SHA checkout) or against github.event.pull_request.head.sha, whichever one the check means to bind. Add a test for each event type.

Activity

  1. abrichr commented on Nov 25, 2026

    @abrichr
    MemberAuthor

    Resolved on main in PR #2275 (9c675cbd0, "fix(ci): bind pull_request_target safety runs to the PR head, not GITHUB_SHA").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions