🔧 Require milestone in PRs (#13129)

Signed-off-by: Yamila Moreno <yamila.moreno@kaleidos.net>
This commit is contained in:
Yamila Moreno 2026-11-18 11:54:01 +01:00 committed by GitHub
parent d563444985
commit 89d5a862b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 0 deletions

View File

@ -37,6 +37,7 @@ jobs:
OWNER="${REPOSITORY%%/*}"
REPO="${REPOSITORY#*/}"
# shellcheck disable=SC2016 # GraphQL variables, not shell expansion.
ISSUES=$(gh api graphql \
-F owner="$OWNER" \
-F repo="$REPO" \

45
.github/workflows/require-milestone.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: Require Milestone
on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited
- milestoned
- demilestoned
- ready_for_review
- converted_to_draft
permissions:
contents: read
pull-requests: read
jobs:
check-milestone:
name: Require Milestone
runs-on: ubuntu-latest
steps:
- name: Check milestone
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
pr_api="repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}"
is_draft=$(gh api "$pr_api" --jq '.draft')
milestone=$(gh api "$pr_api" --jq '.milestone.title // ""')
if [ "$is_draft" = "true" ]; then
echo "Draft PR: milestone check skipped."
exit 0
fi
if [ -z "$milestone" ]; then
echo "::error::This pull request must have a milestone."
exit 1
fi
echo "Milestone assigned: $milestone"