Skip to content

Commit

Permalink
Remove milestone from unmerged PRs (woocommerce#41216)
Browse files Browse the repository at this point in the history
* Remove milestone from unmerged PRs

* Add pr write permission to milestone manager
  • Loading branch information
jonathansadowski authored Nov 3, 2023
1 parent ab51a76 commit 0a11d03
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/milestoned.yml
Original file line number Diff line number Diff line change
@@ -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,
});
4 changes: 1 addition & 3 deletions .github/workflows/pull-request-post-merge-processing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit 0a11d03

Please sign in to comment.