Agentic workflows with GitHub Actions & Copilot: generate-docs, generate-tests, and beyond
| Workflow | Trigger | Description |
|---|---|---|
| Generate Docs | Push | Analyzes commits and creates documentation issues |
| Generate Tests | Push | Identifies missing unit tests and creates issues |
- GitHub repository with GitHub Copilot enabled
- Copilot Coding Agent enabled for your organization/repository
- A Personal Access Token (PAT) with Copilot permissions
The Copilot CLI requires authentication via a Personal Access Token with specific permissions.
-
Visit https://github.com/settings/personal-access-tokens/new
-
Configure your token:
- Token name:
Copilot CLI Token(or any descriptive name) - Expiration: Set as appropriate for your security policies
- Repository access: Select the repositories where you'll use the workflows
- Token name:
-
Under "Permissions", click "Account permissions" and enable:
- Copilot Requests — Required for Copilot CLI to function
-
Click "Generate token" and copy the token immediately (you won't see it again!)
- Go to your repository → Settings → Secrets and variables → Actions
- Click "New repository secret"
- Add:
- Name:
COPILOT_CLI_TOKEN - Value: Paste your PAT from Step 1
- Name:
- Click "Add secret"
Ensure the Copilot Coding Agent is enabled:
- Go to your repository → Settings → Copilot → Coding Agent
- Enable "Allow Copilot to open pull requests"
Make a small code change and push. The workflows should:
- Install Copilot CLI
- Analyze your commit
- Create issues if documentation/tests are needed
- Assign Copilot to resolve the issues automatically