Add validation to ensure PRs have milestones set and that they match the
expected docker next version defined in releases configuration.
This prevents PRs from being merged without proper milestone tracking,
which is important for release management and ensuring changes are
properly categorized for upcoming releases.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,35 @@ |
| 0 |
+name: validate-milestone |
|
| 1 |
+ |
|
| 2 |
+permissions: |
|
| 3 |
+ contents: read |
|
| 4 |
+ |
|
| 5 |
+on: |
|
| 6 |
+ pull_request: |
|
| 7 |
+ types: [opened, synchronize, milestoned, demilestoned, edited] |
|
| 8 |
+ |
|
| 9 |
+jobs: |
|
| 10 |
+ validate-milestone: |
|
| 11 |
+ runs-on: ubuntu-24.04 |
|
| 12 |
+ timeout-minutes: 5 |
|
| 13 |
+ steps: |
|
| 14 |
+ - name: Checkout |
|
| 15 |
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
|
| 16 |
+ with: |
|
| 17 |
+ sparse-checkout: releases |
|
| 18 |
+ |
|
| 19 |
+ - name: Validate milestone matches docker next version |
|
| 20 |
+ run: | |
|
| 21 |
+ expected=$(yq -r '.docker.next' releases/versions.yaml) |
|
| 22 |
+ milestone="${{ github.event.pull_request.milestone.title }}"
|
|
| 23 |
+ |
|
| 24 |
+ if [[ -z "$milestone" ]]; then |
|
| 25 |
+ echo "::error::PR must have a milestone set (expected: $expected)" |
|
| 26 |
+ exit 1 |
|
| 27 |
+ fi |
|
| 28 |
+ |
|
| 29 |
+ if [[ "$milestone" != "$expected" ]]; then |
|
| 30 |
+ echo "::error::Milestone '$milestone' does not match docker next version '$expected'" |
|
| 31 |
+ exit 1 |
|
| 32 |
+ fi |
|
| 33 |
+ |
|
| 34 |
+ echo "Milestone: $milestone ✓" |