2021-11-11 13:35:11 -05:00
|
|
|
name: Add Issue to Board
|
|
|
|
|
|
|
|
on:
|
|
|
|
issues:
|
|
|
|
types: [opened]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
track_issue:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Get project data
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
|
|
run: |
|
|
|
|
gh api graphql -f query='
|
|
|
|
query {
|
|
|
|
organization(login: "revoltchat"){
|
2023-01-24 14:43:32 -05:00
|
|
|
projectV2(number: 3) {
|
2021-11-11 13:35:11 -05:00
|
|
|
id
|
|
|
|
fields(first:20) {
|
|
|
|
nodes {
|
2023-01-24 14:43:32 -05:00
|
|
|
... on ProjectV2SingleSelectField {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
options {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
2021-11-11 13:35:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}' > project_data.json
|
|
|
|
|
2023-01-24 14:43:32 -05:00
|
|
|
echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
|
|
|
|
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
|
|
|
|
echo 'TODO_OPTION_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .options[] | select(.name=="Todo") |.id' project_data.json) >> $GITHUB_ENV
|
2021-11-11 13:35:11 -05:00
|
|
|
|
|
|
|
- name: Add issue to project
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
|
|
ISSUE_ID: ${{ github.event.issue.node_id }}
|
|
|
|
run: |
|
|
|
|
item_id="$( gh api graphql -f query='
|
|
|
|
mutation($project:ID!, $issue:ID!) {
|
2023-01-24 14:43:32 -05:00
|
|
|
addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) {
|
|
|
|
item {
|
2021-11-11 13:35:11 -05:00
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
2023-01-24 14:43:32 -05:00
|
|
|
}' -f project=$PROJECT_ID -f issue=$ISSUE_ID --jq '.data.addProjectV2ItemById.item.id')"
|
|
|
|
|
2021-11-11 13:35:11 -05:00
|
|
|
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
|