Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the GitHub Actions workflow from only setting PR review status to a comprehensive project board automation system that handles both pull requests and issues.
Changes:
- Adds automatic addition of newly opened issues to project board #8
- Implements draft PR detection to skip status updates for draft pull requests
- Renames workflow and job to reflect broader scope
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const alreadyInProject = errors.some(e => | ||
| typeof e.message === 'string' && | ||
| e.message.toLowerCase().includes('already') && | ||
| e.message.toLowerCase().includes('project') | ||
| ); |
There was a problem hiding this comment.
The error detection logic for "already in project" is fragile because it relies on string matching against error messages that may vary or change. The logic checks if both "already" and "project" appear in the error message, which could produce false positives. Consider checking for more specific error codes or types if available in the GitHub GraphQL API error responses, or at minimum use a more precise error message pattern.
| const alreadyInProject = errors.some(e => | |
| typeof e.message === 'string' && | |
| e.message.toLowerCase().includes('already') && | |
| e.message.toLowerCase().includes('project') | |
| ); | |
| const alreadyInProject = errors.some(e => { | |
| if (typeof e.message !== 'string') return false; | |
| const msg = e.message.toLowerCase(); | |
| return msg.includes('already exists in project') || | |
| msg.includes('content already exists in project'); | |
| }); |
| contentId: context.payload.issue.node_id | ||
| }); | ||
|
|
||
| console.log('Successfully added issue to project #8'); |
There was a problem hiding this comment.
The hardcoded project number "8" in the console log message is inconsistent with using PROJECT_ID from secrets. If the project number changes or this workflow is reused for a different project, the log message will be misleading. Consider using a variable or more generic message.
| ); | ||
|
|
||
| if (alreadyInProject) { | ||
| console.log('Issue is already in project #8, skipping add.'); |
There was a problem hiding this comment.
The hardcoded project number "8" in the console log message is inconsistent with using PROJECT_ID from secrets. If the project number changes or this workflow is reused for a different project, the log message will be misleading. Consider using a variable or more generic message.
| if (alreadyInProject) { | ||
| console.log('Issue is already in project #8, skipping add.'); | ||
| } else { | ||
| console.error('Failed to add issue to project #8:', error); |
There was a problem hiding this comment.
The hardcoded project number "8" in the console log message is inconsistent with using PROJECT_ID from secrets. If the project number changes or this workflow is reused for a different project, the log message will be misleading. Consider using a variable or more generic message.
One more