Skip to content

Commit 42befab

Browse files
authored
Fix automated workflow not triggering with /process command (#777)
* Fix workflow trigger conditions and add comprehensive logging
1 parent 7f88cc3 commit 42befab

File tree

3 files changed

+149
-16
lines changed

3 files changed

+149
-16
lines changed

.github/workflows/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# GitHub Workflows
2+
3+
This directory contains automated workflows for the Web We Want project.
4+
5+
## Process Want Submission Workflow
6+
7+
The `process-want-submission.yml` workflow automates the processing of Want submissions.
8+
9+
### Triggers
10+
11+
The workflow is triggered by:
12+
13+
1. **Netlify Form Submission** (`repository_dispatch` event)
14+
- Automatically creates an issue from form submissions
15+
- No manual intervention required
16+
17+
2. **New Want Issue Opened** (`issues` event)
18+
- Automatically processes issues with title starting with `[Auto] New Want:`
19+
20+
3. **Manual Processing via Comment** (`issue_comment` event)
21+
- Any of the following commands in an issue comment will trigger the workflow:
22+
- `/process` - Simple slash command
23+
- `@github-copilot` - Mention Copilot
24+
- `@github-copilot[bot] process` - Full mention with process keyword
25+
26+
4. **PR Merged** (`pull_request` event with `closed` and `merged=true`)
27+
- Converts the related issue to a discussion after a want PR is merged
28+
29+
### Manual Processing
30+
31+
To manually trigger want processing on an existing issue, add a comment with any of these commands:
32+
33+
```
34+
/process
35+
```
36+
37+
or
38+
39+
```
40+
@github-copilot please process this want
41+
```
42+
43+
The workflow will:
44+
1. Log trigger information for debugging
45+
2. Create a processing trigger comment
46+
3. Assign the issue to GitHub Copilot
47+
4. Copilot will follow the instructions in `.github/instructions/wants-processing.instructions.md`
48+
49+
### Debugging
50+
51+
If the workflow doesn't run as expected:
52+
53+
1. Check the workflow run logs in the Actions tab
54+
2. Look for the "Log workflow trigger" step to see what event triggered the workflow
55+
3. Verify the issue title matches the expected pattern (for auto-generated issues)
56+
4. Ensure your comment contains one of the trigger keywords (for manual processing)
57+
58+
### Workflow Steps
59+
60+
1. **Log workflow trigger** - Logs information about what triggered the workflow
61+
2. **Checkout repository** - Checks out the code
62+
3. **Setup Node.js** - Installs Node.js environment
63+
4. **Install dependencies** - Installs npm packages
64+
5. **Create issue from webhook** - For Netlify form submissions
65+
6. **Process existing issue** - For manual triggers via comments
66+
7. **Assign to Copilot** - Creates a comment to trigger Copilot processing
67+
8. **Log completion** - Logs completion status
68+
69+
### Processing Instructions
70+
71+
The detailed processing instructions for GitHub Copilot are located in:
72+
`.github/instructions/wants-processing.instructions.md`
73+
74+
This includes:
75+
- Spam detection
76+
- Relevance checking
77+
- Technology classification
78+
- Duplicate detection
79+
- Want file creation

.github/workflows/process-want-submission.yml

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,26 @@ jobs:
2020
if: |
2121
github.event_name == 'repository_dispatch' ||
2222
(github.event_name == 'issues' && startsWith(github.event.issue.title, '[Auto] New Want:')) ||
23-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@github-copilot[bot]') && contains(github.event.comment.body, 'process-want'))
23+
(github.event_name == 'issue_comment' && (
24+
contains(github.event.comment.body, '/process') ||
25+
contains(github.event.comment.body, '@github-copilot') ||
26+
(contains(github.event.comment.body, '@github-copilot[bot]') && contains(github.event.comment.body, 'process'))
27+
))
2428
runs-on: ubuntu-latest
2529
steps:
30+
- name: Log workflow trigger
31+
run: |
32+
echo "=== Workflow Trigger Information ==="
33+
echo "Event name: ${{ github.event_name }}"
34+
echo "Triggered by: ${{ github.actor }}"
35+
echo "Repository: ${{ github.repository }}"
36+
if [ "${{ github.event_name }}" = "issue_comment" ]; then
37+
echo "Comment author: ${{ github.event.comment.user.login }}"
38+
echo "Issue number: ${{ github.event.issue.number }}"
39+
echo "Issue title: ${{ github.event.issue.title }}"
40+
echo "Comment body (first 200 chars): ${{ github.event.comment.body }}" | head -c 200
41+
fi
42+
echo "==================================="
2643
- name: Checkout repository
2744
uses: actions/checkout@v4
2845
with:
@@ -121,15 +138,27 @@ jobs:
121138
with:
122139
github-token: ${{ secrets.GITHUB_TOKEN }}
123140
script: |
124-
const issue = github.event_name === 'issue_comment'
125-
? context.payload.issue
126-
: context.payload.issue;
127-
128-
const issueBody = issue.body;
141+
console.log('=== Processing existing issue/comment ===');
142+
console.log(`Event name: ${context.eventName}`);
143+
console.log(`Issue number: ${context.payload.issue.number}`);
144+
145+
const issue = context.payload.issue;
146+
const issueBody = issue.body || '';
147+
148+
console.log(`Issue title: ${issue.title}`);
149+
console.log(`Issue body length: ${issueBody.length}`);
150+
129151
const submissionIdMatch = issueBody.match(/\*\*Submission ID:\*\* (.+)/);
130152
const submissionId = submissionIdMatch ? submissionIdMatch[1] : `manual-${issue.number}-${Date.now()}`;
131-
132-
if (github.event_name === 'issue_comment') {
153+
154+
console.log(`Submission ID: ${submissionId}`);
155+
156+
if (context.eventName === 'issue_comment') {
157+
console.log('Processing as issue comment event');
158+
const comment = context.payload.comment;
159+
console.log(`Comment author: ${comment.user.login}`);
160+
console.log(`Comment body: ${comment.body.substring(0, 200)}`);
161+
133162
const commentBody = [
134163
'## Manual Processing Triggered',
135164
'',
@@ -150,12 +179,14 @@ jobs:
150179
`Body: ${issueBody.substring(0, 500)}${issueBody.length > 500 ? '...' : ''}`
151180
].join('\n');
152181
182+
console.log('Creating processing trigger comment...');
153183
await github.rest.issues.createComment({
154184
owner: context.repo.owner,
155185
repo: context.repo.repo,
156186
issue_number: issue.number,
157187
body: commentBody
158188
});
189+
console.log('Processing trigger comment created successfully');
159190
}
160191
161192
return {
@@ -168,9 +199,13 @@ jobs:
168199
with:
169200
github-token: ${{ secrets.GITHUB_TOKEN }}
170201
script: |
202+
console.log('=== Assigning to Copilot ===');
203+
console.log(`Event name: ${context.eventName}`);
204+
171205
// Get issue number from previous steps or current context
172206
let issueNumber;
173-
if (github.event_name === 'repository_dispatch') {
207+
if (context.eventName === 'repository_dispatch') {
208+
console.log('Getting issue from repository_dispatch event');
174209
// For webhook events, we need to find the issue we just created
175210
// We'll use a simple approach and get the most recent issue
176211
const issues = await github.rest.issues.listForRepo({
@@ -183,16 +218,20 @@ jobs:
183218
per_page: 1
184219
});
185220
issueNumber = issues.data[0]?.number;
221+
console.log(`Found issue number: ${issueNumber}`);
186222
} else {
187223
// For issue events, use the issue from the event
188224
issueNumber = context.payload.issue.number;
225+
console.log(`Using issue from event: ${issueNumber}`);
189226
}
190227
191228
if (!issueNumber) {
192-
console.log('Could not determine issue number');
229+
console.log('ERROR: Could not determine issue number');
193230
return;
194231
}
195232
233+
console.log(`Creating Copilot trigger comment on issue #${issueNumber}`);
234+
196235
// Add comment to trigger Copilot processing
197236
await github.rest.issues.createComment({
198237
owner: context.repo.owner,
@@ -203,13 +242,22 @@ jobs:
203242
Follow the 5-step process: spam detection, relevance check, technology classification, duplicate detection, and want PR creation if approved.`
204243
});
205244
206-
console.log(`Issue ${issueNumber} has been assigned to Copilot for processing`);
245+
console.log(`Successfully assigned issue ${issueNumber} to Copilot for processing`);
207246
208247
- name: Log processing completion
209248
run: |
210-
echo "Want submission processing workflow completed"
211-
echo "Check GitHub Actions logs for issue details"
212-
echo "Workflow triggered for submission processing"
249+
echo "==================================="
250+
echo "Want submission processing workflow completed successfully"
251+
echo "Event: ${{ github.event_name }}"
252+
echo "Triggered by: ${{ github.actor }}"
253+
echo "Repository: ${{ github.repository }}"
254+
echo "==================================="
255+
echo ""
256+
echo "Next steps:"
257+
echo "- Check the issue for Copilot's processing comments"
258+
echo "- Review any PR created by Copilot"
259+
echo "- Check GitHub Actions logs for detailed execution trace"
260+
echo "==================================="
213261
214262
convert-issue-to-discussion:
215263
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true

docs/MANUAL_PROCESSING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ Use manual processing for:
1414
### Method 1: Issue Comment Trigger
1515

1616
1. Navigate to the GitHub issue you want to process
17-
2. Add a comment with the text `/process-want` or `/process`
17+
2. Add a comment with one of these trigger commands:
18+
- `/process` - Simple slash command
19+
- `/process-want` - Alternative slash command
20+
- `@github-copilot` - Mention Copilot directly
21+
- `@github-copilot[bot] please process this want` - Full mention with instruction
1822
3. The workflow will automatically trigger and process the issue
1923

2024
### Method 2: Repository Dispatch (for bulk processing)
@@ -87,8 +91,10 @@ The manual processing can result in several outcomes:
8791

8892
### Workflow Doesn't Trigger
8993
- Ensure you have proper repository permissions
90-
- Check that the comment contains a trigger phrase
94+
- Check that the comment contains a trigger phrase (e.g., `/process`, `@github-copilot`)
9195
- Verify the workflow file is present and valid
96+
- Check the Actions tab to see if the workflow was skipped and review the logs
97+
- Review `.github/workflows/README.md` for trigger requirements
9298

9399
### Processing Fails
94100
- Check the Actions tab for error details

0 commit comments

Comments
 (0)