Test project action - please ignore #106
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 Ingest project | |
on: | |
issues: | |
types: | |
- labeled | |
env: | |
INGEST_PROJECT_ID: 'PVT_kwDOAGc3Zs4AogrP' | |
ECOSYSTEM_LABEL: 'Team:Ecosystem' | |
AREA_FIELD_ID: 'PVTSSF_lADOAGc3Zs4AogrPzggEiBs' | |
ECOSYSTEM_OPTION_ID: 'b85d422b' | |
permissions: | |
contents: read | |
jobs: | |
add_to_ingest_project: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: octokit/graphql-action@v2.x | |
id: add_to_project | |
if: github.event.label.name == env.ECOSYSTEM_LABEL | |
with: | |
query: | | |
# Variables have to be snake cased because of https://github.com/octokit/graphql-action/issues/164 | |
mutation AddToIngestProject($project_id: ID!, $content_id: ID!) { | |
addProjectV2ItemById(input: { projectId: $project_id, contentId: $content_id }) { | |
item { | |
id | |
} | |
} | |
} | |
project_id: ${{ env.INGEST_PROJECT_ID }} | |
content_id: ${{ github.event.issue.node_id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJECT_ASSIGNER_TOKEN }} | |
- uses: octokit/graphql-action@v2.x | |
id: set_ecosystem_area | |
if: github.event.label.name == env.ECOSYSTEM_LABEL | |
with: | |
query: | | |
mutation updateIngestArea($item_id: ID!, $project_id: ID!, $area_field_id: ID!, $area_id: String) { | |
updateProjectV2ItemFieldValue( | |
input: { itemId: $item_id, projectId: $project_id, fieldId: $area_field_id, value: { singleSelectOptionId: $area_id } }) { | |
clientMutationId | |
} | |
} | |
item_id: ${{ fromJSON(steps.add_to_project.outputs.data).addProjectV2ItemById.item.id }} | |
project_id: ${{ env.INGEST_PROJECT_ID }} | |
area_field_id: ${{ env.AREA_FIELD_ID }} | |
area_id: ${{ env.ECOSYSTEM_OPTION_ID }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJECT_ASSIGNER_TOKEN }} | |