Skip to content

GHA to ensure milestone #1

GHA to ensure milestone

GHA to ensure milestone #1

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.');