Skip to content

Commit e8f657b

Browse files
committed
PR musst be linked to the project through the project not pr
Adding the project to the pr will not include it to the projet itself and therfore not provide a node id (required for moving columns) Signed-off-by: Samreet <samreet.singh@iteratec.com>
1 parent 5e2b65c commit e8f657b

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

.github/workflows/move-dependabot-pr-to-review.yaml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,47 @@ on:
99

1010

1111
jobs:
12-
move-dependabot-pr-to-review:
13-
env:
14-
PR_NUMBER: ${{ github.event.pull_request.number}}
12+
move-dependabot-pr-to-review:
1513
runs-on: ubuntu-22.04
1614
steps:
1715
- uses: actions/checkout@v4
1816

1917
- name: Add dependabot PR to project
2018
run: |
19+
# Get the ID for the field Status
20+
# gh project list --owner secureCodeBox
21+
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ"
22+
2123
# Add item to project
22-
gh pr edit $PR_NUMBER --add-project "secureCodeBox v4"
24+
echo prNodeID=$(gh api graphql -f query='
25+
mutation {
26+
addProjectV2ItemById(input: {projectId: "$secureCodeBoxV4ProjectID" contentId: "$PR_ID"}) {
27+
item {
28+
id
29+
}
30+
}
31+
}' | jq '.data.addProjectV2ItemById.item.id') >> $GITHUB_ENV
2332
env:
2433
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}
34+
PR_ID: ${{ github.event.pull_request.node_id }}
2535

2636
- name: Add dependabot PR to column To Review
2737
run: |
2838
# Get the ID for the field Status
2939
# gh project field-list 6 --owner secureCodeBox
3040
StatusFieldID="PVTSSF_lADOAg-Nic05Gc4AAZuO"
31-
32-
# Get the projectID
33-
# gh project list --owner secureCodeBox
41+
3442
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ"
3543
3644
# ID for status "To Review"
3745
ToReviewID="00b0c876"
3846
47+
prNodeID=${{env.prNodeID}}
3948
# Move PR to "To Review" status
40-
gh project item-edit --id $PR_ID --field-id $StatusFieldID --project-id $seureCodeBoxV4ProjectID --single-select-option-id $ToReviewID
49+
gh project item-edit --id ${{ env.prNodeID }} --field-id $StatusFieldID --project-id "$seureCodeBoxV4ProjectID" --single-select-option-id "$ToReviewID"
4150
4251
43-
# This command gets theIDs for the status options
52+
# This command gets the IDs for the status options
4453
#gh api graphql -f query='
4554
# query {
4655
# organization(login: "secureCodeBox") {
@@ -112,5 +121,4 @@ jobs:
112121
# }
113122
#}
114123
env:
115-
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}
116-
PR_ID: ${{ github.event.pull_request.node_id }}
124+
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}

0 commit comments

Comments
 (0)