-
Notifications
You must be signed in to change notification settings - Fork 78
Update the project workflow #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mempool
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,21 +1,68 @@ | ||||||||||||||||||||||||
| # Workflow: Automatically set project status to "Review Needed" when a reviewer is requested | ||||||||||||||||||||||||
| name: Set Project Status on Review Request | ||||||||||||||||||||||||
| # Workflow: Automate project board management | ||||||||||||||||||||||||
| # - Add newly created issues to project #8 | ||||||||||||||||||||||||
| # - Set status to "Review Needed" when a reviewer is requested on a non-draft PR | ||||||||||||||||||||||||
| name: Project Board Automation | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Trigger: Runs whenever a reviewer is requested on a pull request | ||||||||||||||||||||||||
| # Triggers: Review requested on PRs, or new issues opened | ||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||
| types: [review_requested] | ||||||||||||||||||||||||
| issues: | ||||||||||||||||||||||||
| types: [opened] | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| update-project-status: | ||||||||||||||||||||||||
| manage-project-board: | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - name: Update Project Status to Review Needed | ||||||||||||||||||||||||
| - name: Update Project Board | ||||||||||||||||||||||||
| uses: actions/github-script@v7 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| # Use the PAT stored in repository secrets (has project write access) | ||||||||||||||||||||||||
| github-token: ${{ secrets.PROJECT_TOKEN }} | ||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||
| // Skip draft PRs | ||||||||||||||||||||||||
| if (context.eventName === 'pull_request' && context.payload.pull_request.draft) { | ||||||||||||||||||||||||
| console.log('PR is a draft, skipping Review Needed status...'); | ||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Handle new issues - add to project | ||||||||||||||||||||||||
| if (context.eventName === 'issues') { | ||||||||||||||||||||||||
| const addMutation = ` | ||||||||||||||||||||||||
| mutation($projectId: ID!, $contentId: ID!) { | ||||||||||||||||||||||||
| addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) { | ||||||||||||||||||||||||
| item { id } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||
| await github.graphql(addMutation, { | ||||||||||||||||||||||||
| projectId: "${{ secrets.PROJECT_ID }}", | ||||||||||||||||||||||||
| contentId: context.payload.issue.node_id | ||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| console.log('Successfully added issue to project #8'); | ||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||
| // Handle case where the issue is already in the project, or log other failures | ||||||||||||||||||||||||
| const errors = error && error.errors ? error.errors : []; | ||||||||||||||||||||||||
| const alreadyInProject = errors.some(e => | ||||||||||||||||||||||||
| typeof e.message === 'string' && | ||||||||||||||||||||||||
| e.message.toLowerCase().includes('already') && | ||||||||||||||||||||||||
| e.message.toLowerCase().includes('project') | ||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
|
Comment on lines
+49
to
+53
|
||||||||||||||||||||||||
| 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'); | |
| }); |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.