Skip to content
Next Next commit
Added workflow that adds dependabot pr directly to review column
Signed-off-by: Samreet <samreet.singh@iteratec.com>
Co-authored-by: Ilyes Ben Dlala <ilyes.bendlala@iteratec.com>
  • Loading branch information
Reet00 and Ilyesbdlala committed Nov 21, 2024
commit 14d9b4d7b1110ffb39e993b79dfaf69a0714fb31
114 changes: 114 additions & 0 deletions .github/workflows/move-dependabot-pr-to-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0

name: Move Dependabot PRs to Review
on:
pull_request:
types: [reopened] # For testing the workflow

permissions:
contents: read
pull-requests: read
repository-projects: write

jobs:
move-dependabot-pr-to-review:
env:
PR_ID: ${{ github.event.pull_request.id }}
PR_NUMBER: ${{ github.event.pull_request.number}}
runs-on: ubuntu-22.04
steps:
- name: Add dependabot PR to column To Review
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token

# Get the ID for the field Status
# gh project field-list 6 --owner secureCodeBox
StatusFieldID="PVTSSF_lADOAg-Nic05Gc4AAZuO"

# Get the projectID
# gh project list --owner secureCodeBox
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ"

# ID for status "To Review"
ToReviewID="00b0c876"

# Add item to project
gh pr edit $PR_NUMBER --add-project "secureCodeBox v4"
# Move PR to "To Review" status
gh project item-edit --id $PR_ID --field-id $StatusFieldID --project-id $seureCodeBoxV4ProjectID --single-select-option-id $ToReviewID


# This command gets theIDs for the status options
#gh api graphql -f query='
# query {
# organization(login: "secureCodeBox") {
# projectV2(number: 6) {
# fields(first: 20) {
# nodes {
# ... on ProjectV2SingleSelectField {
# id
# name
# options {
# id
# name
# }
# }
# }
# }
# }
# }
# }'

#
# "data": {
# "organization": {
# "projectV2": {
# "fields": {
# "nodes": [
# {},
# {},
# {
# "id": "PVTSSF_lADOAg-Nic05Gc4AAZuO",
# "name": "Status",
# "options": [
# "organization": {
# {
# "id": "fdb7acaa",
# "name": "Backlog"
# },
# {
# "id": "f75ad846",
# "name": "Todo"
# },
# {
# "id": "47fc9ee4",
# "name": "In Progress"
# },
# {
# "id": "00b0c876",
# "name": "To Review"
# },
# {
# "id": "ea7b630a",
# "name": "Reviewer Approved"
# },
# {
# "id": "98236657",
# "name": "Done"
# }
# ]
# },
# {},
# {},
# {},
# {},
# {}
# ]
# }
# }
# }
# }
#}