Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 2.13 KB

File metadata and controls

63 lines (48 loc) · 2.13 KB
name Copilot PR Lifecycle
description Marks Copilot-created draft PRs ready, requests review, and enables auto-merge
timeout-minutes 5
true
pull_request
types
opened
if github.event.pull_request.draft == true && github.event.pull_request.user.login == 'copilot-swe-agent[bot]'
permissions
contents pull-requests
read
read
engine
id model
copilot
claude-sonnet
tools
bash
gh:*
echo
post-steps
name env run
Mark PR ready for review
GH_TOKEN PR_NUMBER
${{ github.token }}
${{ github.event.pull_request.number }}
echo "Copilot PR #$PR_NUMBER detected as draft — marking ready" gh pr ready "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" || true
name env run
Request Copilot review
GH_TOKEN PR_NUMBER
${{ github.token }}
${{ github.event.pull_request.number }}
gh pr edit "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --add-reviewer "@copilot" 2>/dev/null || echo "Copilot reviewer not available"
name env run
Enable auto-merge
GH_TOKEN PR_NUMBER
${{ github.token }}
${{ github.event.pull_request.number }}
gh pr merge "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --squash --auto --delete-branch || echo "Auto-merge enabled (will merge when approved)"

Copilot PR Lifecycle Handler

Context

This workflow fires when GitHub Copilot's coding agent opens a draft pull request. Copilot creates draft PRs when assigned to issues, but has no built-in mechanism to mark them ready for review or enable auto-merge.

Instructions

This is a lifecycle management workflow. The actual work happens in post-steps. Your only job is to confirm the PR exists and report its status:

  1. Read the PR number from the environment: the PR number is available as $__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__.

  2. Check the PR:

gh pr view "$__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__" --repo "$GITHUB_REPOSITORY" --json number,title,isDraft,headRefName,baseRefName
  1. Report what you found. No edits, no code changes. The post-steps block handles the draft-to-ready transition, review request, and auto-merge enablement.