|
1 | 1 | # agentics-template |
2 | 2 | A template to get started with GitHub Agentic Workflows |
| 3 | + |
| 4 | +## Getting Started |
| 5 | + |
| 6 | +This repository is a template for creating GitHub Agentic Workflows. Agentic workflows allow you to use AI agents (like GitHub Copilot) to automate tasks in your repository. |
| 7 | + |
| 8 | +## Configuring Tokens for Agentic Workflows |
| 9 | + |
| 10 | +GitHub Agentic Workflows require specific tokens to authenticate with various services. GitHub Actions always provides `GITHUB_TOKEN` automatically, but for advanced features like Copilot workflows, you'll need to configure additional tokens. |
| 11 | + |
| 12 | +### Quick Start: Tokens You Need to Configure |
| 13 | + |
| 14 | +Create these repository secrets based on what features you need: |
| 15 | + |
| 16 | +| When you need this... | Secret to create | Notes | |
| 17 | +|----------------------|------------------|-------| |
| 18 | +| Cross-repo operations / remote GitHub tools | `GH_AW_GITHUB_TOKEN` | PAT or app token with cross-repo access | |
| 19 | +| Copilot workflows (CLI, engine, agent tasks, etc.) | `COPILOT_GITHUB_TOKEN` | Needs Copilot Requests permission and repo access | |
| 20 | +| Assigning agents/bots to issues or pull requests | `GH_AW_AGENT_TOKEN` | Used by `assign-to-agent` and Copilot assignee/reviewer flows | |
| 21 | +| Any GitHub Projects v2 operations | `GH_AW_PROJECT_GITHUB_TOKEN` | **Required** for `update-project`. Default `GITHUB_TOKEN` cannot access Projects v2 API | |
| 22 | +| Isolating MCP server permissions (advanced optional) | `GH_AW_GITHUB_MCP_SERVER_TOKEN` | Only if you want MCP to use a different token than other jobs | |
| 23 | + |
| 24 | +### Step-by-Step: Configuring Tokens for Copilot |
| 25 | + |
| 26 | +Follow these steps to set up GitHub Copilot in your agentic workflows: |
| 27 | + |
| 28 | +#### 1. Create a Personal Access Token for Copilot |
| 29 | + |
| 30 | +1. Go to [GitHub Personal Access Tokens settings](https://github.com/settings/personal-access-tokens/new) |
| 31 | +2. Configure the token: |
| 32 | + - **Resource owner**: Your user account (not organization) |
| 33 | + - **Repository access**: "Public repositories" or select specific repos |
| 34 | + - **Permissions**: Select "Copilot Requests" (required) |
| 35 | +3. Generate the token and copy it |
| 36 | + |
| 37 | +#### 2. Set the Copilot Token as a Repository Secret |
| 38 | + |
| 39 | +Add the token as a repository secret using the GitHub website: |
| 40 | + |
| 41 | +1. Go to your repository on GitHub |
| 42 | +2. Click **Settings** > **Secrets and variables** > **Actions** |
| 43 | +3. Click **New repository secret** |
| 44 | +4. Set the name to `COPILOT_GITHUB_TOKEN` |
| 45 | +5. Paste your Personal Access Token in the **Secret** field |
| 46 | +6. Click **Add secret** |
| 47 | + |
| 48 | +#### 3. (Optional) Configure Additional Tokens |
| 49 | + |
| 50 | +If you need additional capabilities, add these tokens as repository secrets following the same steps above: |
| 51 | + |
| 52 | +- **For cross-repository operations**: Create a secret named `GH_AW_GITHUB_TOKEN` |
| 53 | +- **For agent assignment operations**: Create a secret named `GH_AW_AGENT_TOKEN` |
| 54 | +- **For GitHub Projects v2 operations**: Create a secret named `GH_AW_PROJECT_GITHUB_TOKEN` |
| 55 | + |
| 56 | +## Creating Workflows |
| 57 | + |
| 58 | +### Using the Create Agentic Workflow Agent |
| 59 | + |
| 60 | +The easiest way to create a new agentic workflow is to use the built-in custom agent: |
| 61 | + |
| 62 | +1. Go to your repository on GitHub |
| 63 | +2. Click on the **Actions** tab |
| 64 | +3. Click **Create new agentic task** |
| 65 | +4. In the agent selection, choose **create-agentic-workflow** |
| 66 | +5. Describe what you want your workflow to do (e.g., "Create a workflow that triages new issues and adds labels") |
| 67 | +6. The agent will generate the workflow file for you |
| 68 | + |
| 69 | +### Debugging and Improving Workflows |
| 70 | + |
| 71 | +If you encounter issues with a workflow or want to improve it: |
| 72 | + |
| 73 | +1. Go to your repository on GitHub |
| 74 | +2. Click on the **Actions** tab |
| 75 | +3. Click **Create new agentic task** |
| 76 | +4. In the agent selection, choose **debug-agentic-workflow** |
| 77 | +5. Provide the GitHub URL to your failed workflow run (e.g., `https://github.com/owner/repo/actions/runs/12345`) |
| 78 | +6. The agent will analyze the logs and suggest fixes or improvements |
| 79 | + |
| 80 | +## Additional Resources |
| 81 | + |
| 82 | +- [GitHub Agentic Workflows Documentation](https://githubnext.github.io/gh-aw/) |
| 83 | +- [Token Reference](https://github.com/githubnext/gh-aw/blob/main/docs/src/content/docs/reference/tokens.md) |
| 84 | +- [CLI Documentation](https://githubnext.github.io/gh-aw/setup/cli/) |
0 commit comments