|
# SPDX-FileCopyrightText: the secureCodeBox authors |
|
# |
|
# SPDX-License-Identifier: Apache-2.0 |
|
|
|
name: Move bot PRs to Review |
|
on: |
|
pull_request: |
|
types: [opened] |
|
branches: |
|
- main |
|
|
|
permissions: |
|
contents: read |
|
pull-requests: write |
|
|
|
jobs: |
|
move-bot-pr-to-review: |
|
runs-on: ubuntu-24.04 |
|
# only run if the branch starts with 'dependabot/' or 'dependencies/upgrading' |
|
if: startsWith(github.head_ref, 'dependabot/') || startsWith(github.head_ref, 'dependencies/upgrading') |
|
steps: |
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
|
|
|
- name: Add bot PR to project |
|
run: | |
|
# Get the ID for the field Status |
|
# gh project list --owner secureCodeBox |
|
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ" |
|
|
|
# Add item to project |
|
echo prNodeID=$(gh api graphql -f query=" |
|
mutation { |
|
addProjectV2ItemById(input: {projectId: \"$secureCodeBoxV4ProjectID\", contentId: \"$PR_ID\"}) { |
|
item { |
|
id |
|
} |
|
} |
|
}" | jq -r '.data.addProjectV2ItemById.item.id') >> $GITHUB_ENV |
|
env: |
|
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }} |
|
PR_ID: ${{ github.event.pull_request.node_id }} |
|
|
|
- name: Move PR to column To Review |
|
# only move SCB-Bot, since dependabot is not part of core team and therefore has no access to secrets |
|
if: startsWith(github.head_ref, 'dependencies/upgrading') |
|
run: | |
|
# Get the ID for the field Status |
|
# gh project field-list 6 --owner secureCodeBox |
|
StatusFieldID="PVTSSF_lADOAg-Nic05Gc4AAZuO" |
|
|
|
secureCodeBoxV4ProjectID="PVT_kwDOAg-Nic05GQ" |
|
|
|
# ID for status "To Review" |
|
ToReviewID="00b0c876" |
|
|
|
prNodeID=${{env.prNodeID}} |
|
# Move PR to "To Review" status |
|
gh project item-edit --id ${{ env.prNodeID }} --field-id $StatusFieldID --project-id $secureCodeBoxV4ProjectID --single-select-option-id $ToReviewID |
|
|
|
env: |
|
GH_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }} |