AEDP Sprint #13 - Dec 3 #3
This file contains 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: Add Issue to Second Project | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
add-issue-to-project: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add Issue to Secondary Project | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const projectId = 'YOUR_SECOND_PROJECT_ID'; // Replace with your target project ID | |
const issue = context.payload.issue; | |
const addProjectItem = await github.graphql(` | |
mutation($projectId: ID!, $contentId: ID!) { | |
addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) { | |
item { | |
id | |
} | |
} | |
} | |
`, { | |
projectId: projectId, | |
contentId: issue.node_id | |
}); | |
console.log(`Issue #${issue.number} added to project with item ID: ${addProjectItem.addProjectV2ItemById.item.id}`); |