mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-09 08:43:37 -05:00
chore(ci): update CI tasks to move PRs when updated
This commit is contained in:
parent
71c0a782c1
commit
c29efc155b
1 changed files with 64 additions and 64 deletions
128
.github/workflows/triage_pr.yml
vendored
128
.github/workflows/triage_pr.yml
vendored
|
@ -1,72 +1,72 @@
|
||||||
name: Add PR to Board
|
name: Add PR to Board
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened]
|
types: [opened, edited, ready_for_review, review_requested]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
track_pr:
|
track_pr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Get project data
|
- name: Get project data
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||||
run: |
|
run: |
|
||||||
gh api graphql -f query='
|
gh api graphql -f query='
|
||||||
query {
|
query {
|
||||||
organization(login: "revoltchat"){
|
organization(login: "revoltchat"){
|
||||||
projectNext(number: 3) {
|
projectNext(number: 3) {
|
||||||
id
|
id
|
||||||
fields(first:20) {
|
fields(first:20) {
|
||||||
nodes {
|
nodes {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
settings
|
settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}' > project_data.json
|
}' > project_data.json
|
||||||
|
|
||||||
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
|
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
|
||||||
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
|
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
|
||||||
echo 'INCOMING_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Incoming PRs") |.id' project_data.json) >> $GITHUB_ENV
|
echo 'INCOMING_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Incoming PRs") |.id' project_data.json) >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Add PR to project
|
- name: Add PR to project
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||||
PR_ID: ${{ github.event.pull_request.node_id }}
|
PR_ID: ${{ github.event.pull_request.node_id }}
|
||||||
run: |
|
run: |
|
||||||
item_id="$( gh api graphql -f query='
|
item_id="$( gh api graphql -f query='
|
||||||
mutation($project:ID!, $pr:ID!) {
|
mutation($project:ID!, $pr:ID!) {
|
||||||
addProjectNextItem(input: {projectId: $project, contentId: $pr}) {
|
addProjectNextItem(input: {projectId: $project, contentId: $pr}) {
|
||||||
projectNextItem {
|
projectNextItem {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}' -f project=$PROJECT_ID -f pr=$PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
|
}' -f project=$PROJECT_ID -f pr=$PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
|
||||||
|
|
||||||
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set fields
|
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
- name: Set fields
|
||||||
run: |
|
env:
|
||||||
gh api graphql -f query='
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||||
mutation (
|
run: |
|
||||||
$project: ID!
|
gh api graphql -f query='
|
||||||
$item: ID!
|
mutation (
|
||||||
$status_field: ID!
|
$project: ID!
|
||||||
$status_value: String!
|
$item: ID!
|
||||||
) {
|
$status_field: ID!
|
||||||
set_status: updateProjectNextItemField(input: {
|
$status_value: String!
|
||||||
projectId: $project
|
) {
|
||||||
itemId: $item
|
set_status: updateProjectNextItemField(input: {
|
||||||
fieldId: $status_field
|
projectId: $project
|
||||||
value: $status_value
|
itemId: $item
|
||||||
}) {
|
fieldId: $status_field
|
||||||
projectNextItem {
|
value: $status_value
|
||||||
id
|
}) {
|
||||||
}
|
projectNextItem {
|
||||||
}
|
id
|
||||||
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.INCOMING_OPTION_ID }} --silent
|
}
|
||||||
|
}
|
||||||
|
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.INCOMING_OPTION_ID }} --silent
|
||||||
|
|
Loading…
Reference in a new issue