Skip to content

Commit

Permalink
GHA to ensure milestone
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Apr 2, 2024
1 parent 1787e5a commit 27a4c3f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ensure-milestone-to-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check if pull request is milestoned
on:
pull_request:
types: [opened, edited, milestoned, demilestoned]

jobs:
check_milestone:
runs-on: ubuntu-latest
steps:
- name: Check milestone
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
if (!pullRequest.milestone) {
throw new Error('Pull request does not have a milestone. Please add a milestone.');
}
console.log('Pull request has a milestone.');

0 comments on commit 27a4c3f

Please sign in to comment.