Handle PID Not Found Error #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Project Board | |
| # To disable this workflow, set the ENABLE_PROJECT_SYNC variable to 'false' | |
| # in repo Settings > Secrets and variables > Actions > Variables | |
| on: | |
| pull_request_target: | |
| types: [opened] | |
| issues: | |
| types: [opened] | |
| jobs: | |
| add-to-project: | |
| if: vars.ENABLE_PROJECT_SYNC != 'false' | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.PROJECT_PAT }} | |
| script: | | |
| const projectId = 'PVT_kwHOCFc8rs4BbxbM'; | |
| const contentId = (context.payload.pull_request || context.payload.issue).node_id; | |
| const number = (context.payload.pull_request || context.payload.issue).number; | |
| const type = context.payload.pull_request ? 'PR' : 'Issue'; | |
| core.info(`Adding ${type} #${number} to project...`); | |
| await github.graphql(` | |
| mutation($projectId: ID!, $contentId: ID!) { | |
| addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) { | |
| item { | |
| id | |
| } | |
| } | |
| } | |
| `, { projectId, contentId }); | |
| core.info(`${type} #${number} added to project.`); |