Skip to content

Commit 574dfeb

Browse files
authored
CI - automatically convert new dependabot PRs to draft (#8043)
dependabot PRs are processed once a month. In a meantime they should be in a draft mode and have the "status/on-hold" label. Here we automate this for new dependabot PRs. The workflow can be also started manually for testing - provided the target PR is from dependabot.
1 parent fcdf63e commit 574dfeb

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/pr-labeler.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,20 @@ jobs:
7575
env:
7676
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
7777
run: ./dev_tools/ci/size-labeler.sh
78+
79+
label-dependabot-pr:
80+
if: >-
81+
github.repository_owner == 'quantumlib' &&
82+
(github.event.action == 'opened' || github.event_name == 'workflow_dispatch') &&
83+
github.event.pull_request.user.login == 'dependabot[bot]'
84+
name: Convert dependabot PR to draft
85+
runs-on: ubuntu-slim
86+
timeout-minutes: 5
87+
steps:
88+
- name: Convert to draft and attach the on-hold label
89+
env:
90+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
91+
PULL_REQUEST_URL: ${{github.event.pull_request.html_url}}
92+
run: |
93+
gh pr ready "${PULL_REQUEST_URL}" --undo
94+
gh pr edit "${PULL_REQUEST_URL}" --add-label status/on-hold

0 commit comments

Comments
 (0)