Summary
Add reusable GitHub Actions workflows to automatically add newly opened or reopened issues and pull requests to the relevant GitHub Project.
Why
Issues and pull requests are not automatically captured by a project when they originate from multiple repositories. These workflows ensure that newly opened or reopened issues and pull requests are consistently added to the appropriate team project without manual intervention.
The workflows use the organisation-provided CLOUD_PROJECT_NUMBER variable to determine the target project, allowing the workflows to be reused across repositories without hard-coding project details.
The implementation uses reusable workflows from datasciencecampus/github-actions, with project routing handled by the existing Project Router Bot.
Proposed workflows
Add Issue To Projects
name: Add Issue To Projects
on:
issues:
types: [opened, reopened]
permissions:
contents: read
jobs:
add-issue-to-projects:
uses: datasciencecampus/github-actions/.github/workflows/add-issue-to-projects.yml@aacc6cca7266747b0565ac39673d96998c094312 # v1.3.0
secrets:
PROJECT_ROUTER_BOT_PRIVATE_KEY: ${{ secrets.PROJECT_ROUTER_BOT_PRIVATE_KEY }}
with:
repository: ${{ github.event.repository.name }}
issue_node_id: ${{ github.event.issue.node_id }}
project_field_values: ${{ format('[{{"project":{0}}}]', vars.CLOUD_PROJECT_NUMBER) }}
Add Pull Request To Projects
name: Add Pull Request To Projects
on:
pull_request:
types: [opened, reopened]
permissions:
contents: read
jobs:
add-pr-to-projects:
uses: datasciencecampus/github-actions/.github/workflows/add-pr-to-projects.yml@aacc6cca7266747b0565ac39673d96998c094312 # v1.3.0
secrets:
PROJECT_ROUTER_BOT_PRIVATE_KEY: ${{ secrets.PROJECT_ROUTER_BOT_PRIVATE_KEY }}
with:
repository: ${{ github.event.repository.name }}
pull_request_node_id: ${{ github.event.pull_request.node_id }}
project_field_values: ${{ format('[{{"project":{0},"field":"Status","value":"Review"}}]', vars.CLOUD_PROJECT_NUMBER) }}
Configuration
No repository-level variable or secret configuration should be required.
The CLOUD_PROJECT_NUMBER variable and PROJECT_ROUTER_BOT_PRIVATE_KEY secret are expected to already be available from the organisation and are consumed by the workflows directly.
The reusable workflows are pinned to commit aacc6cca7266747b0565ac39673d96998c094312 (v1.3.0) to ensure consistent behaviour.
Acceptance criteria
- Newly opened issues are automatically added to the project specified by the organisation-provided
CLOUD_PROJECT_NUMBER.
- Reopened issues are automatically added to the project specified by
CLOUD_PROJECT_NUMBER.
- Newly opened pull requests are automatically added to the project specified by
CLOUD_PROJECT_NUMBER with the Status field set to Review.
- Reopened pull requests are automatically added to the project specified by
CLOUD_PROJECT_NUMBER with the Status field set to Review.
- The existing organisation-provided
PROJECT_ROUTER_BOT_PRIVATE_KEY secret is used.
- The reusable workflows are pinned to the specified commit SHA.
- A test issue and pull request confirm that both workflows successfully add items to the project.
Summary
Add reusable GitHub Actions workflows to automatically add newly opened or reopened issues and pull requests to the relevant GitHub Project.
Why
Issues and pull requests are not automatically captured by a project when they originate from multiple repositories. These workflows ensure that newly opened or reopened issues and pull requests are consistently added to the appropriate team project without manual intervention.
The workflows use the organisation-provided
CLOUD_PROJECT_NUMBERvariable to determine the target project, allowing the workflows to be reused across repositories without hard-coding project details.The implementation uses reusable workflows from
datasciencecampus/github-actions, with project routing handled by the existing Project Router Bot.Proposed workflows
Add Issue To Projects
Add Pull Request To Projects
Configuration
No repository-level variable or secret configuration should be required.
The
CLOUD_PROJECT_NUMBERvariable andPROJECT_ROUTER_BOT_PRIVATE_KEYsecret are expected to already be available from the organisation and are consumed by the workflows directly.The reusable workflows are pinned to commit
aacc6cca7266747b0565ac39673d96998c094312(v1.3.0) to ensure consistent behaviour.Acceptance criteria
CLOUD_PROJECT_NUMBER.CLOUD_PROJECT_NUMBER.CLOUD_PROJECT_NUMBERwith theStatusfield set toReview.CLOUD_PROJECT_NUMBERwith theStatusfield set toReview.PROJECT_ROUTER_BOT_PRIVATE_KEYsecret is used.