Skip to content

feat(pr-sous-chef): run formatters and push to branch#33125

Merged
pelikhan merged 2 commits into
mainfrom
copilot/run-formatters-if-needed
May 18, 2026
Merged

feat(pr-sous-chef): run formatters and push to branch#33125
pelikhan merged 2 commits into
mainfrom
copilot/run-formatters-if-needed

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

pr-sous-chef previously only nudged PRs via comments and branch updates. This extends it to actively fix formatting issues by running make fmt on each eligible PR branch and pushing any changes back.

Frontmatter changes (lock file recompiled)

  • checkout: fetch: ["refs/pulls/open/*"], fetch-depth: 0 — makes all open PR branches available locally
  • network: allowed: ["defaults", "go"] — permits Go module downloads during fmt
  • Setup steps: Go, Node.js, npm ci, make deps-dev — installs formatter toolchain into agent sandbox
  • Tools: added edit: and bash allowlist entries for git fetch/checkout/diff/status/restore + make fmt
  • push-to-pull-request-branch: target: "*", if-no-changes: ignore, excluded-files: [".github/workflows/**"], suffix [pr-sous-chef]
  • Timeout: 15 → 25 min to cover setup + per-PR fmt cycles

Agent instructions (no recompile needed)

New step 0 prepended to Required nudges for eligible PRs:

git checkout <headRefName>
make fmt
git diff --quiet || push_to_pull_request_branch(pr_number)
git checkout -

formatter_pushes counter added to the run-summary noop.

Copilot AI and others added 2 commits May 18, 2026 18:52
- Add checkout config with fetch: ["refs/pulls/open/*"] and fetch-depth: 0
- Add network: allowed: ["defaults", "go"] for Go module access
- Add setup steps: Go, Node.js, npm ci, make deps-dev
- Add bash tools: git fetch/checkout/diff/status/restore, make fmt
- Add edit: tool
- Add push-to-pull-request-branch safe-output (target: *, if-no-changes: ignore)
- Update agent instructions with step 0: run make fmt and push if dirty
- Increase timeout-minutes to 25 to account for setup and formatting cycles
- Track formatter_pushes in run summary

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan May 18, 2026 18:54
@pelikhan pelikhan marked this pull request as ready for review May 18, 2026 18:59
Copilot AI review requested due to automatic review settings May 18, 2026 18:59
@pelikhan pelikhan merged commit 1ee7c20 into main May 18, 2026
@pelikhan pelikhan deleted the copilot/run-formatters-if-needed branch May 18, 2026 18:59
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

Extends the pr-sous-chef agentic workflow to proactively run repository formatters (make fmt) on eligible PR branches and push resulting formatting fixes back to the PR branch.

Changes:

  • Fetches all open PR refs with full history and allows Go module network access to support formatter execution.
  • Adds Go/Node toolchain setup + dependency installation steps needed for make fmt.
  • Enables push_to_pull_request_branch safe-output with guardrails (excluded workflow files, commit title suffix) and increases workflow timeout; updates run summary to include formatter_pushes.
Show a summary per file
File Description
.github/workflows/pr-sous-chef.md Adds checkout/network/tooling setup and agent instructions to run make fmt per PR and push changes via a new safe-output.
.github/workflows/pr-sous-chef.lock.yml Recompiled lock file reflecting new setup steps, fetched refs, safe-output tool wiring, permissions, and timeout changes.

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: 2

- Checkout the PR branch: `git checkout <headRefName>`
- Run `make fmt` to format all code (Go, JavaScript, JSON)
- Check for changes: `git diff --quiet || echo "dirty"`
- If dirty, call `push_to_pull_request_branch` with the PR number to push the formatting fixes
Comment on lines +199 to +205
0. **Run formatters and push if needed**
- Checkout the PR branch: `git checkout <headRefName>`
- Run `make fmt` to format all code (Go, JavaScript, JSON)
- Check for changes: `git diff --quiet || echo "dirty"`
- If dirty, call `push_to_pull_request_branch` with the PR number to push the formatting fixes
- Return to the original branch: `git checkout -`
- Skip this step silently if `make fmt` exits non-zero (tools unavailable)
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.

3 participants