Skip to content

Clarify push_to_pull_request_branch behavior for multi-checkout workflows#36238

Merged
dsyme merged 6 commits into
mainfrom
copilot/needed-explicit-prompting-for-push-to-pull-request
Jun 1, 2026
Merged

Clarify push_to_pull_request_branch behavior for multi-checkout workflows#36238
dsyme merged 6 commits into
mainfrom
copilot/needed-explicit-prompting-for-push-to-pull-request

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

push_to_pull_request_branch already supports cross-repo checkouts, but prompt guidance was not explicit enough in multi-checkout layouts (e.g., editing/pushing from $GITHUB_WORKSPACE/github). This update makes the operational path explicit so agents reliably run git commands in the correct checkout before invoking the safe-output push tool.

  • Prompt guidance (agent-facing)

    • Expanded actions/setup/md/safe_outputs_push_to_pr_branch.md with explicit multi-checkout instructions:
      • operate from the target repo checkout path
      • cd into that checkout before git operations
  • Prompt section behavior coverage

    • Added focused assertions in pkg/workflow/unified_prompt_step_test.go to verify PR-comment prompt assembly:
      • guidance is injected when push-to-pull-request-branch is configured
      • guidance is not injected when it is not configured
**Multi-checkout workflows (`checkout:` with multiple repositories):**
- `push_to_pull_request_branch` operates on the checkout for the target repository.
- Run all `git` commands from that checkout directory before calling the tool.
- If needed, check out the PR branch locally from `origin/<pr-branch>` first.

Generated by 👨‍🍳 PR Sous Chef · gpt54 12.3M ·

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve explicit prompting for push-to-pull-request-branch Clarify push_to_pull_request_branch behavior for multi-checkout workflows Jun 1, 2026
Copilot finished work on behalf of dsyme June 1, 2026 13:33
Copilot AI requested a review from dsyme June 1, 2026 13:33
@github-actions github-actions Bot mentioned this pull request Jun 1, 2026
@dsyme dsyme marked this pull request as ready for review June 1, 2026 15:01
Copilot AI review requested due to automatic review settings June 1, 2026 15:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR clarifies how push_to_pull_request_branch should be used in multi-checkout GitHub Actions workflows and adds tests to ensure PR-comment prompt assembly includes (or omits) the push-to-PR-branch guidance based on configuration.

Changes:

  • Expanded safe_outputs_push_to_pr_branch.md with explicit guidance for multi-checkout layouts (operate from the target repo checkout and cd into it before running git).
  • Added assertions in unified_prompt_step_test.go to verify the PR-comment guidance section is injected only when push-to-pull-request-branch is configured.
Show a summary per file
File Description
pkg/workflow/unified_prompt_step_test.go Adds focused tests verifying conditional injection of push-to-PR-branch guidance for PR-comment workflows.
actions/setup/md/safe_outputs_push_to_pr_branch.md Documents multi-checkout operational steps so agents run git in the correct checkout before pushing.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread actions/setup/md/safe_outputs_push_to_pr_branch.md Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

PR Code Quality Reviewer completed the code quality review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #36238 does not have the 'implementation' label (has_implementation_label=false) and has only 44 new lines in business logic directories, which is below the 100-line threshold (requires_adr_by_default_volume=false). No custom design-gate config overrides apply.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🧪 Test Quality Sentinel completed test quality analysis.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /zoom-out and /tdd — approving with two minor suggestions.

📋 Key Themes & Highlights

Key Themes

  • Example specificity: The hardcoded $GITHUB_WORKSPACE/github path is idiomatic to this repo and may mislead agents in other repos — a generic placeholder would travel better.
  • Event coverage: The positive test only exercises issue_comment; worth either expanding or commenting on whether other PR event types are intentionally excluded.

Positive Highlights

  • ✅ Clear, concise documentation addition — directly addresses the silent failure mode described in the PR
  • ✅ Solid complementary test pair: positive (guidance present) + negative (guidance absent) covers the injection contract cleanly
  • ✅ Tight EnvVars assertion prevents accidental changes to the conditional expression

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 1.2M

Comment thread actions/setup/md/safe_outputs_push_to_pr_branch.md
Comment thread pkg/workflow/unified_prompt_step_test.go
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 1.5M

Comment thread pkg/workflow/unified_prompt_step_test.go
Comment thread actions/setup/md/safe_outputs_push_to_pr_branch.md Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100 — Excellent

Analyzed 2 test scenario(s) across 1 modified test file: 2 design tests (behavioral contracts), 0 implementation tests, 0 guideline violations.

📊 Metrics & Test Classification (2 tests analyzed)
Metric Value
New/modified tests analyzed 2 (sub-tests of 1 new Test* function)
✅ Design tests (behavioral contracts) 2 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 1 (50%) — negative-path sub-test
Duplicate test clusters 0
Test inflation detected No
🚨 Coding-guideline violations 0

Test Classification Details

Test File Classification Issues Detected
includes guidance when PR comment triggers and push-to-pr-branch is configured pkg/workflow/unified_prompt_step_test.go:524 ✅ Design None — verifies ShellCondition, event filter, and EnvVars content
does not include guidance when push-to-pr-branch is not configured pkg/workflow/unified_prompt_step_test.go:524 ✅ Design None — negative path (absence of section)

Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 2 sub-tests (unit — //go:build !integration)
  • 🟨 JavaScript: 0 tests

Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%). Build tag present (//go:build !integration). No mocks. All assertions include descriptive messages.

📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct

Goal: Shift toward tests that describe the system's behavioral contract.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 1.2M ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 100/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). Both sub-tests verify behavioral contracts, build tag is present, no mocks used, and all assertions include descriptive messages.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

@copilot please inspect the failing test and build-wasm checks after the branch refresh, then summarize the remaining blockers.

Generated by 👨‍🍳 PR Sous Chef · gpt54 12.3M ·

dsyme and others added 2 commits June 1, 2026 17:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ded test coverage

- Replace repo-specific path example with generic description
- Replace ambiguous cd instruction with subshell/pushd guidance
- Add pull_request_review_comment trigger test case
- Add SafeOutputs: nil negative test case
@github-actions github-actions Bot added the spam label Jun 1, 2026
@github github deleted a comment Jun 1, 2026
@github github deleted a comment Jun 1, 2026
@dsyme dsyme merged commit 774b186 into main Jun 1, 2026
32 checks passed
@dsyme dsyme deleted the copilot/needed-explicit-prompting-for-push-to-pull-request branch June 1, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Needed explicit prompting for push-to-pull-request-branch in multi-repo checkout

3 participants