Workflow setup
Enable the Copilot action for pull_request events and what runs when.
Workflow setup
To run Copilot on pull request events, add a workflow that uses the pull_request trigger and passes the required inputs (at least token). This page describes the events to use and a minimal workflow example.
Trigger events
Use the pull_request trigger with the types you need. Common setup:
on:
pull_request:
types: [opened, reopened, edited, labeled, unlabeled, closed, assigned, unassigned, synchronize]
| Event type | When it runs | Typical use |
|---|---|---|
opened | A new PR is created | Link to issue, link to projects, assign reviewers, apply size/priority, generate AI description (if enabled). |
reopened | A closed PR is reopened | Re-apply linking and labels. |
edited | PR title or body is edited | Update linking/labels; regenerate or update AI description if configured. |
labeled / unlabeled | Labels change | Sync project/state if needed. |
synchronize | New commits are pushed to the PR branch | Re-run size/priority (and progress if push workflow runs); AI description can be updated. |
closed | PR is closed or merged | Update project state. |
assigned / unassigned | Assignees or reviewers change | Sync if your flow depends on it. |
For first-time setup, at least opened and synchronize are useful so that new PRs get full treatment and updates when the branch changes.
Minimal workflow
Create a file under .github/workflows/ (e.g. copilot_pull_request.yml):
name: Copilot - Pull Request
on:
pull_request:
types: [opened, reopened, edited, labeled, unlabeled, closed, assigned, unassigned, synchronize]
jobs:
copilot-pull-requests:
name: Copilot - Pull Request
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: vypdev/copilot@v2
with:
token: ${{ secrets.PAT }}
project-ids: ${{ vars.PROJECT_IDS }}
tokenis required (use a fine-grained PAT with repo and project permissions; see Authentication).project-idsis optional but needed if you want PRs linked to GitHub Project boards and moved to columns (e.g. "In Progress").
Add other inputs as needed: desired-reviewers-count, commit-prefix-transforms, ai-pull-request-description, opencode-server-url, opencode-model, etc. See Configuration and Examples.
What runs when
-
On every trigger (with valid
token): The action loads the PR and repository context. If the event actor is the same as the token owner, the action may skip the normal pipeline (see Troubleshooting); use a bot account for the PAT if you want full behavior when you open your own PRs. -
PR–issue linking: The action infers the issue number from the PR branch name (e.g.
feature/123-add-login→ issue123) and links the PR to that issue (and posts a comment on the PR when configured). -
Project linking: If
project-idsis set, the PR is added to those projects and moved to the configured column (e.g. "In Progress"). See Capabilities. -
Reviewers: If
desired-reviewers-countis set, the action assigns up to that many reviewers. See Configuration. -
Size and priority: The action computes size (XS–XXL) and progress (if OpenCode is configured) from the branch diff and applies the corresponding labels to the issue and to the PR. Same thresholds as in Configuration.
-
AI PR description: If
ai-pull-request-descriptionis true and OpenCode is configured, the action can generate or update the PR description from the issue and the branch diff. See AI PR description. -
Comments and images: The action can post a comment on the PR with optional images per branch type (feature, bugfix, etc.). See Capabilities.
Next steps
- Capabilities — Detailed list of what the action does on PRs.
- Configuration — All PR-related inputs.
- Examples — Full workflow YAML examples.