Skip to content

Commit 35a7773

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 35a7773

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@ on:
1111
jobs:
1212
move-dependabot-pr-to-review:
1313
env:
14-
PR_NUMBER: ${{ github.event.pull_request.number}}
14+
PR_ID: ${{ github.event.pull_request.node_id }}
1515
runs-on: ubuntu-22.04
1616
steps:
1717
- uses: actions/checkout@v4
1818

1919
- name: Add dependabot PR to project
2020
run: |
21+
# Get the ID for the field Status
22+
# gh project list --owner secureCodeBox
23+
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ"
24+
2125
# Add item to project
22-
gh pr edit $PR_NUMBER --add-project "secureCodeBox v4"
26+
echo prNodeID=$(gh api graphql -f query='
27+
mutation {
28+
addProjectV2ItemById(input: {projectId: $secureCodeBoxV4ProjectID contentId: $PR_ID}) {
29+
item {
30+
id
31+
}
32+
}
33+
}' | jq '.data.addProjectV2ItemById.item.id') >> $GITHUB_ENV
2334
env:
2435
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}
2536

@@ -28,19 +39,18 @@ jobs:
2839
# Get the ID for the field Status
2940
# gh project field-list 6 --owner secureCodeBox
3041
StatusFieldID="PVTSSF_lADOAg-Nic05Gc4AAZuO"
31-
32-
# Get the projectID
33-
# gh project list --owner secureCodeBox
42+
3443
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ"
3544
3645
# ID for status "To Review"
3746
ToReviewID="00b0c876"
3847
48+
prNodeID=${{env.prNodeID}}
3949
# 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
50+
gh project item-edit --id ${{env.prNodeID}} --field-id $StatusFieldID --project-id $seureCodeBoxV4ProjectID --single-select-option-id $ToReviewID
4151
4252
43-
# This command gets theIDs for the status options
53+
# This command gets the IDs for the status options
4454
#gh api graphql -f query='
4555
# query {
4656
# organization(login: "secureCodeBox") {
@@ -112,5 +122,4 @@ jobs:
112122
# }
113123
#}
114124
env:
115-
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}
116-
PR_ID: ${{ github.event.pull_request.node_id }}
125+
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}

0 commit comments

Comments
 (0)