X Tutup
Skip to content

Commit a238d29

Browse files
committed
Dynamically resolve the column ID for "Needs review"
1 parent c1c936b commit a238d29

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/prauto.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
env:
1111
GH_REPO: ${{ github.repository }}
1212
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13-
NEEDSREVIEWCOL: "MDEzOlByb2plY3RDb2x1bW43MTEwMTI4"
1413
PRID: ${{ github.event.pull_request.node_id }}
1514
PRBODY: ${{ github.event.pull_request.body }}
1615
PRNUM: ${{ github.event.pull_request.number }}
@@ -26,10 +25,21 @@ jobs:
2625
gh pr close $PRNUM
2726
}
2827
28+
colID () {
29+
gh api graphql -f query='query($owner:String!, $repo:String!) {
30+
repository(owner:$owner, name:$repo) {
31+
project(number:1) {
32+
columns(first:10) { nodes {id,name} }
33+
}
34+
}
35+
}' -F owner=:owner -F repo=:repo \
36+
-q ".data.repository.project.columns.nodes[] | select(.name | startswith(\"$1\")) | .id"
37+
}
38+
2939
addToBoard () {
3040
gh api graphql --silent -f query='
3141
mutation($colID:ID!, $pr:ID!) { addProjectCard(input: { projectColumnId: $colID, contentId: $prID }) { clientMutationId } }
32-
' -f colID="$NEEDSREVIEWCOL" -f prID="$PRID"
42+
' -f colID="$(colID "Needs review")" -f prID="$PRID"
3343
}
3444
3545
if gh api orgs/cli/public_members/$PRAUTHOR --silent 2>/dev/null

0 commit comments

Comments
 (0)
X Tutup