automate marking as draft on requesting changes

This commit is contained in:
Frank Elsinga 2026-01-14 11:08:19 +01:00
parent c2fd12238f
commit 8fff956c6d
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
name: Mark PR as draft on requested changes
on:
pull_request_review:
types: [submitted]
permissions:
pull-requests: write
contents: read
jobs:
mark-draft:
if: github.event.review.state == 'changes_requested'
runs-on: ubuntu-latest
steps:
- name: Mark PR as draft
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr ready "$PR_URL" --undo
- name: Add label
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
run: |
gh issue edit "$PR_NUMBER" \
--repo "$OWNER/$REPO" \
--add-label "pr:please address review comments"