Skip to content

Commit aa2d936

Browse files
authored
Use GitHub UI project selection instead of manual URL entry in campaign template (#8425)
1 parent 6d6fde3 commit aa2d936

File tree

5 files changed

+92
-37
lines changed

5 files changed

+92
-37
lines changed

.github/ISSUE_TEMPLATE/start-campaign.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,30 @@ body:
88
value: |
99
## Start an Agentic Campaign
1010
11-
Provide project board URL and campaign goal. The AI generates technical specs, best practices, and governance policies.
11+
**📌 Important: Project Board Assignment**
12+
13+
This campaign must be assigned to a GitHub Project board. You have two options:
14+
15+
**Option A (Recommended):** Create this issue from your project board:
16+
1. Open your GitHub Project board
17+
2. Click "Add item" → "Create new issue"
18+
3. Select this repository and choose this template
19+
4. The project will be automatically assigned ✅
20+
21+
**Option B:** Create from issues page (assign project before submitting):
22+
1. Fill out the form below
23+
2. **Scroll down and use the project selector at the bottom** to assign a project board
24+
3. Submit the issue
25+
26+
The AI will automatically detect the project board assignment and generate the campaign specification with the correct project URL.
1227
1328
**Process:**
14-
1. AI analyzes goal and generates campaign spec
15-
2. PR created with spec and orchestrator files
16-
3. Review and merge to activate
17-
18-
- type: input
19-
id: project_url
20-
attributes:
21-
label: Project Board URL
22-
description: URL of your GitHub Project board for tracking this agentic campaign
23-
placeholder: https://github.com/orgs/your-org/projects/123
24-
validations:
25-
required: true
29+
1. Fill out the campaign goal and context fields below
30+
2. **Ensure a project board is assigned** (see options above)
31+
3. Submit the issue
32+
4. AI analyzes goal and generates campaign spec with project tracking
33+
5. PR created with spec and orchestrator files
34+
6. Review and merge to activate
2635
2736
- type: textarea
2837
id: campaign_goal

.github/agents/agentic-campaign-designer.agent.md

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ This agent operates in two distinct modes:
1919
When triggered from a GitHub issue created via a "Create a Campaign" issue form:
2020

2121
1. **Parse the Issue Form Data** - Extract campaign requirements from the issue body:
22-
- **Campaign Name**: The `campaign_name` field from the issue form
23-
- **Campaign Description**: The `campaign_description` field describing the campaign's purpose
22+
- **Agentic Campaign Goal**: The `campaign_goal` field describing what the campaign should accomplish
2423
- **Additional Context**: The optional `additional_context` field with extra requirements
24+
- **Project Board Assignment**: Query the issue's project assignments to get the project URL
2525

2626
2. **Generate the Campaign Specification** - Create a complete `.campaign.md` file without interaction:
27+
- Derive a clear campaign name from the goal
2728
- Analyze requirements and determine campaign ID (kebab-case)
29+
- Retrieve project URL from issue's project board assignment
2830
- Identify required workflows and their purposes
2931
- Determine owners, sponsors, and risk level
3032
- Configure allowed safe outputs for campaign operations
3133
- Apply governance and security best practices
3234

3335
3. **Create the Campaign File** at `.github/workflows/<campaign-id>.campaign.md`:
34-
- Use a kebab-case campaign ID derived from the campaign name (e.g., "Security Q1 2025" → "security-q1-2025")
36+
- Use a kebab-case campaign ID derived from the goal (e.g., "Security Vulnerability Remediation" → "security-vulnerability-remediation")
3537
- **CRITICAL**: Before creating, check if the file exists. If it does, append a suffix like `-v2` or a timestamp
36-
- Include complete frontmatter with all necessary configuration
38+
- Include complete frontmatter with all necessary configuration including the project URL
3739
- Write a clear description of campaign goals and agent behavior
3840

3941
4. **Compile the Campaign** using `gh aw compile <campaign-id>` to generate the orchestrator workflow
@@ -88,11 +90,13 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv
8890

8991
3. **Campaign Spec Fields**
9092

91-
Based on the conversation, determine values for:
93+
Based on the conversation (Interactive Mode) or issue data (Issue Form Mode), determine values for:
9294
- `id` — stable identifier in kebab-case (e.g., `security-q1-2025`)
9395
- `name` — human-friendly title
9496
- `description` — short explanation of campaign purpose
9597
- `project-url` — GitHub Project URL for campaign dashboard
98+
- **Issue Form Mode**: Retrieve from issue's project assignments using GitHub CLI
99+
- **Interactive Mode**: Ask the user for the project URL
96100
- `workflows` — workflow IDs (basenames under `.github/workflows/` without `.md`)
97101
- `memory-paths` — repo-memory paths under `memory/campaigns/<campaign-id>-*/**`
98102
- `owners` — primary human owners
@@ -118,35 +122,54 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv
118122

119123
When processing a GitHub issue created via the campaign creation form, follow these steps:
120124

121-
### Step 1: Parse the Issue Form
125+
### Step 1: Parse the Issue Form and Retrieve Project Assignment
122126

123127
Extract the following fields from the issue body:
124-
- **Campaign Name** (required): Look for the "Campaign Name" section
125-
- **Campaign Description** (required): Look for the "Campaign Description" section
128+
- **Agentic Campaign Goal** (required): Look for the "Agentic Campaign Goal" section
126129
- **Additional Context** (optional): Look for the "Additional Context" section
130+
- **Project Board Assignment** (required): Query the issue's project board assignments using GitHub CLI
127131

128132
Example issue body format:
129133
```
130-
### Campaign Name
131-
Security Q1 2025
132-
133-
### Campaign Description
134+
### Agentic Campaign Goal
134135
Automated security improvements and vulnerability remediation
135136
136137
### Additional Context (Optional)
137-
Should track progress in a GitHub Project and allow creating issues and PRs
138+
Should allow creating issues and PRs
139+
```
140+
141+
**Important: Retrieve the Project Board URL from Issue Assignments**
142+
143+
The user adds the issue to a GitHub Project board via the UI after creating the issue. You must query this assignment using GitHub CLI (replace `ISSUE_NUMBER` with the actual issue number from `github.event.issue.number`):
144+
145+
```bash
146+
gh issue view ISSUE_NUMBER --json projectItems --jq '.projectItems.nodes[0]?.project?.url // empty'
138147
```
139148

149+
Alternatively, use the github-issue-query skill (from the repository root):
150+
151+
```bash
152+
./skills/github-issue-query/query-issues.sh --jq '.[] | select(.number == ISSUE_NUMBER) | .projectItems.nodes[0]?.project?.url // empty'
153+
```
154+
155+
**If no project is assigned:**
156+
- Inform the user that a project board assignment is required
157+
- Provide clear instructions: "Please assign this issue to a GitHub Project board using the project selector in the issue sidebar, then mention me again to continue."
158+
- Explain they can also recreate the issue from the project board directly (which auto-assigns the project)
159+
- Do not proceed with campaign creation without a valid project URL
160+
140161
### Step 2: Design the Campaign Specification
141162

142-
Based on the parsed requirements, determine:
163+
Based on the parsed requirements and project assignment, determine:
143164

144-
1. **Campaign ID**: Convert the campaign name to kebab-case (e.g., "Security Q1 2025" → "security-q1-2025")
145-
2. **Workflows**: Identify workflows needed to implement the campaign
146-
3. **Owners**: Determine who will own and maintain the campaign
147-
4. **Risk Level**: Assess the risk level based on the campaign's scope
148-
5. **Safe Outputs**: Determine which safe outputs should be allowed
149-
6. **Approval Policy**: Define approval requirements based on risk level
165+
1. **Campaign Name**: Derive a clear campaign name from the goal (e.g., "Security Vulnerability Remediation", "Node.js Migration")
166+
2. **Campaign ID**: Convert the campaign name to kebab-case (e.g., "Security Vulnerability Remediation" → "security-vulnerability-remediation")
167+
3. **Project URL**: Use the project URL retrieved from the issue's project assignments
168+
4. **Workflows**: Identify workflows needed to implement the campaign
169+
5. **Owners**: Determine who will own and maintain the campaign
170+
6. **Risk Level**: Assess the risk level based on the campaign's scope
171+
7. **Safe Outputs**: Determine which safe outputs should be allowed
172+
8. **Approval Policy**: Define approval requirements based on risk level
150173

151174
### Step 3: Create the Campaign File
152175

docs/src/content/docs/guides/campaigns/getting-started.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,27 @@ Campaign tooling enforces that a campaign repo-memory write includes a cursor an
8282

8383
## Start an agentic campaign with GitHub Issue Forms
8484

85-
This repo also includes a “🚀 Start an Agentic Campaign” issue form. Use it when you want to capture intent first and let an agent scaffold the spec in a PR.
85+
This repo also includes a "🚀 Start an Agentic Campaign" issue form. Use it when you want to capture intent first and let an agent scaffold the spec in a PR.
86+
87+
### Creating the Campaign Issue
88+
89+
**Option A (Recommended):** Create from your project board:
90+
1. Open your GitHub Project board
91+
2. Click "Add item" → "Create new issue"
92+
3. Select this repository and choose the "🚀 Start an Agentic Campaign" template
93+
4. The project will be automatically assigned to the issue ✅
94+
95+
**Option B:** Create from the repository's Issues page:
96+
1. Navigate to Issues → New Issue
97+
2. Select "🚀 Start an Agentic Campaign"
98+
3. **Important:** Before submitting, scroll down and use the project selector to assign the issue to your project board
99+
100+
Creating the issue from the project board (Option A) is recommended as it ensures the project is automatically assigned and reduces the chance of forgetting this required step.
86101

87102
When you submit the issue form:
88103

89104
1. **an agentic campaign issue is created** - This becomes your campaign's central hub with the `campaign` and `campaign-tracker` labels
90-
2. **An agent validates your project board** - Ensures the URL is accessible and properly configured
105+
2. **An agent validates your project board** - Ensures the project assignment exists and is accessible
91106
3. **an agentic campaign spec is generated** - Creates `.github/workflows/<id>.campaign.md` with your inputs as a PR
92107
4. **The spec is linked to the issue** - So you can track the technical implementation
93108
5. **Your project board is configured** - The agent sets up tracking labels and fields
@@ -101,3 +116,4 @@ You manage the agentic campaign from the issue. The generated workflow files are
101116
- **Lower barrier to entry**: No need to understand campaign spec file format
102117
- **Traceable**: Issue serves as the agentic campaign's command center with full history
103118
- **Agent-assisted scaffolding**: Automated generation of spec files and workflows
119+
- **Automatic project assignment**: When created from project board, the project is automatically linked

skills/github-issue-query/SKILL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ Use the `--jq` argument to filter and transform the output:
8888
./query-issues.sh --jq '.[] | {number, title, labels: [.labels[].name]}'
8989
```
9090

91+
**Get project board assignments:**
92+
```bash
93+
./query-issues.sh --jq '.[] | {number, title, projects: [.projectItems.nodes[]? | .project?.url]}'
94+
```
95+
9196
**Find old issues (created over 30 days ago):**
9297
```bash
9398
./query-issues.sh --jq '.[] | select(.createdAt < (now - 2592000 | strftime("%Y-%m-%dT%H:%M:%SZ")))'

skills/github-issue-query/query-issues.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ while [[ $# -gt 0 ]]; do
4747
done
4848

4949
# JSON fields to fetch
50-
JSON_FIELDS="number,title,state,author,createdAt,updatedAt,closedAt,body,labels,assignees,comments,milestone,url"
50+
JSON_FIELDS="number,title,state,author,createdAt,updatedAt,closedAt,body,labels,assignees,comments,milestone,url,projectItems"
5151

5252
# Build and execute gh command with proper quoting
5353
if [[ -n "$REPO" ]]; then
@@ -93,7 +93,8 @@ else
9393
"assignees": "array - Array of assignee objects with login field",
9494
"comments": "object - Comments info with totalCount field",
9595
"milestone": "object|null - Milestone info with title field",
96-
"url": "string - Issue URL"
96+
"url": "string - Issue URL",
97+
"projectItems": "object - Project assignments with totalCount and nodes array containing project info"
9798
}
9899
},
99100
"suggested_queries": [
@@ -104,6 +105,7 @@ else
104105
{"description": "Get issues with label", "query": ".[] | select(.labels | map(.name) | index(\"bug\"))"},
105106
{"description": "Get issues with many comments", "query": ".[] | select(.comments.totalCount > 5) | {number, title, comments: .comments.totalCount}"},
106107
{"description": "Get issues with labels", "query": ".[] | {number, title, labels: [.labels[].name]}"},
108+
{"description": "Get issues with project assignments", "query": ".[] | {number, title, projects: [.projectItems.nodes[]? | .project?.url]}"},
107109
{"description": "Count by state", "query": "group_by(.state) | map({state: .[0].state, count: length})"}
108110
]
109111
}

0 commit comments

Comments
 (0)