Remove milestone from unmerged PRs (#41216)

* Remove milestone from unmerged PRs

* Add pr write permission to milestone manager
This commit is contained in:
jonathansadowski 2023-11-03 13:22:07 -05:00 committed by GitHub
parent ab51a761a3
commit 0a11d03ce5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 3 deletions

26
.github/workflows/milestoned.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Milestone Manager
on:
pull_request_target:
types: [milestoned]
permissions: {}
jobs:
remove-milestone-from-unmerged-prs:
name: "Remove Milestone from Unmerged PRs"
if: github.event.pull_request.merged != true
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
milestone: null,
});

View File

@ -38,9 +38,7 @@ jobs:
with:
php-version: '7.4'
- name: 'Run the script to assign a milestone'
if: |
!github.event.pull_request.milestone &&
github.event.pull_request.base.ref == 'trunk'
if: github.event.pull_request.base.ref == 'trunk'
run: php assign-milestone-to-merged-pr.php
env:
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}