Skip to content

safe_outputs checkout fails for pull_request_review events #18547

@strawgate

Description

@strawgate

Bug

The safe_outputs job checkout step uses ref: ${{ github.base_ref || github.ref_name }}. For pull_request_review events, github.base_ref is empty (GitHub only populates it for pull_request and pull_request_target events), so the expression falls through to github.ref_name which is N/merge — an invalid ref for checkout.

ref: 648/merge
[command]/usr/bin/git fetch ... +refs/heads/648/merge*:refs/remotes/origin/648/merge*
The process '/usr/bin/git' failed with exit code 1

Both push_to_pull_request_branch.cjs and create_pull_request.cjs do their own git fetch + git checkout -B at runtime, so the initial checkout just needs to succeed.

Introduced in

Affected locations

  • compiler_safe_outputs_steps.go:158 — checkout ref
  • compiler_safe_outputs_config.go:464,484base_branch in handler config
  • create_pull_request.go:103GH_AW_BASE_BRANCH env var
  • create_agent_session.go:115GITHUB_AW_AGENT_SESSION_BASE env var

Fix

Add github.event.pull_request.base.ref or github.event.repository.default_branch as a middle fallback:

${{ github.base_ref || github.event.pull_request.base.ref || github.ref_name }}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions