Dynamically resolve the column ID for "Needs review"
This commit is contained in:
parent
c1c936b74b
commit
a238d2952d
1 changed files with 12 additions and 2 deletions
14
.github/workflows/prauto.yml
vendored
14
.github/workflows/prauto.yml
vendored
|
|
@ -10,7 +10,6 @@ jobs:
|
|||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NEEDSREVIEWCOL: "MDEzOlByb2plY3RDb2x1bW43MTEwMTI4"
|
||||
PRID: ${{ github.event.pull_request.node_id }}
|
||||
PRBODY: ${{ github.event.pull_request.body }}
|
||||
PRNUM: ${{ github.event.pull_request.number }}
|
||||
|
|
@ -26,10 +25,21 @@ jobs:
|
|||
gh pr close $PRNUM
|
||||
}
|
||||
|
||||
colID () {
|
||||
gh api graphql -f query='query($owner:String!, $repo:String!) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
project(number:1) {
|
||||
columns(first:10) { nodes {id,name} }
|
||||
}
|
||||
}
|
||||
}' -F owner=:owner -F repo=:repo \
|
||||
-q ".data.repository.project.columns.nodes[] | select(.name | startswith(\"$1\")) | .id"
|
||||
}
|
||||
|
||||
addToBoard () {
|
||||
gh api graphql --silent -f query='
|
||||
mutation($colID:ID!, $pr:ID!) { addProjectCard(input: { projectColumnId: $colID, contentId: $prID }) { clientMutationId } }
|
||||
' -f colID="$NEEDSREVIEWCOL" -f prID="$PRID"
|
||||
' -f colID="$(colID "Needs review")" -f prID="$PRID"
|
||||
}
|
||||
|
||||
if gh api orgs/cli/public_members/$PRAUTHOR --silent 2>/dev/null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue