Skip to content

ci(milestone): set the release milestone on issues and PRs (#2218) - #2219

Merged
JarryShaw merged 1 commit into
mainfrom
ci/2218-milestone-on-close
Oct 26, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
ci/2218-milestone-on-close

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • ci — CI configuration

Description

Closes #2218. Milestones stopped being set after #1068. The closed items have been backfilled by hand onto PyPCAPKit v1.5, and this workflow keeps them set from now on.

  • milestone.yml: runs on issues and pull_request_target (opened, reopened, closed) and on workflow_dispatch, with its logic in util/milestone.py. Opening an item sets the milestone, per the owner on ci: set milestones automatically on close #2218.
    • An open item, a merged PR or a completed issue gets the open milestone titled PyPCAPKit v<major>.<minor>. The version is parsed from the base branch's pcapkit/__init__.py, not imported.
    • An unmerged PR, or a not-planned or duplicate issue, loses its milestone.
    • With no matching milestone, it warns and creates nothing.
    • A milestone already on an item, for example one set by hand to a later release, is kept. Only a removal overrides it.
  • Backfill: workflow_dispatch covers open and closed items above the previous milestone's highest number, above Prevent maintenance workflow push races #336 today. It defaults to dry_run: true.
  • Security: it checks out only github.sha (the base tip) with persist-credentials: false, fetching only the three files it needs. permissions: {} at the top; the job holds only contents: read, issues: write and pull-requests: write. The item is re-read through the API, and only its number comes from the payload.
  • Docs: workflows.rst documents the workflow, and process.rst names the real milestone titles.
  • Fail-without-fix: the new tests cannot collect on origin/main. With only the script present, they give 11 failed (all workflow and step tests). Against the close-only version, the open, reopen and precedence tests give 16 failed.
  • Tests run: the new file gives 49 passed. The workflow-wide tests/project selection gives 733 passed. actionlint is clean.
  • Overlap: docs(contributing): sixth whole-repo pass over the non-API docs (#1103) #2213 and ci(compat): compile the 3.8-floor util scripts on the 3.8 leg (#2206) #2214 also edit workflows.rst, and git merge-tree merges each of them with this cleanly.

@JarryShaw JarryShaw added ci Pull requests that change CI or workflow configuration (ci: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at d55eafa3f (Sonnet). Three non-blocking follow-ups are being folded in, after which a delta review follows.

  • Security: it checks out github.sha only, sparse, with persist-credentials: false. The item number goes through env:, with no ${{ }} in run:. __version__ is read with ast.parse. Permissions are minimal. The hardening and pin tests pass.
  • Rule: action_for sets on a merged PR or a completed issue and removes on an unmerged PR or a not-planned or duplicate issue. It does nothing on no reason or a reopen. This matches the existing v1.5 milestone.
  • Versions: 1.5.0b14 maps to v1.5, 1.10.0 to v1.10 and 2.0.0.post1 to v2.0. A malformed version raises. A missing or closed milestone gives a warning and no write.
  • Dry-run, live with a GET-only wrapper: 7 GETs and no writes. The bound is Prevent maintenance workflow push races #336, and nothing pre-1.5 is touched.
  • Tests: 445 passed across 19 files. Fail-without-fix: the tests do not collect on origin/main.
  • Follow-ups:
    • Backfill PATCHes have no throttle or retry, so a large run could hit the secondary rate limit.
    • Concurrency lacks queue: max, unlike project-status.yml.
    • A header comment is change-relative.

@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 26, 2026
@JarryShaw
JarryShaw force-pushed the ci/2218-milestone-on-close branch from d55eafa to 86dbdad Compare October 26, 2026 00:24
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 86dbdad92 (Sonnet delta review of d55eafa3f→86dbdad92).

  • Throttle: 1.0s between backfill writes only, with none on a dry run or a single item.
  • Retry:
    • The --include parsing reads a synthetic 403 with Retry-After: 30 as rate-limited, and a plain 403 as not, so a plain 403 is not retried.
    • Waits are at most 3 (60/120/240s, or Retry-After), then it raises. The PATCH is idempotent.
    • If gh printed no headers on failure, it would fall back to the previous fail-fast behaviour.
  • Timeout: timeout-minutes: 60 covers about 7 minutes of throttled writes plus retry stalls.
  • Concurrency: queue: max matches project-status.yml, and the Lint step's existing actionlint ignore covers it.
  • Comments: timeless and accurate.
  • Tests: test_milestone_2218.py gives 45 passed. The workflow-wide selection gives 243 passed.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
@JarryShaw JarryShaw added review: pending No verdict for the current head - never reviewed, or the head moved since the last one and removed review: good-to-go Cross-review at the current head says ready; CI state is separate labels Oct 26, 2026
Problem: issues and pull requests carried no release milestone unless
one was set by hand.

Fix: milestone.yml runs util/milestone.py on `issues` and
`pull_request_target` `opened`, `reopened` and `closed`, and on
`workflow_dispatch`. An open item, a merged PR or an issue closed as
completed gets the open `PyPCAPKit v<major>.<minor>` milestone from the
base checkout's `__version__`, read as text, but only when it holds no
other milestone; an unmerged PR or a not-planned/duplicate issue loses
whichever it holds. A missing milestone is a warning, never created. A
dispatch backfills open and closed items with no milestone above the
previous release milestone's highest number, dry-run by default, with
updates a second apart and rate-limited requests retried with backoff.
Runs per item queue with `queue: max`. The job checks out `github.sha`
only, without persisted credentials, under `permissions: {}` plus
`contents: read`, `issues: write` and `pull-requests: write` on the job.

Test: tests/project/test_milestone_2218.py covers the rule, precedence
over a hand-set milestone, the title mapping, both modes against a fake
REST endpoint, the throttle and retry against mocked gh responses, and
the workflow's triggers, scopes, concurrency, base-only checkout and
step script.
@JarryShaw
JarryShaw force-pushed the ci/2218-milestone-on-close branch from 86dbdad to 95feb56 Compare October 26, 2026 00:45
@JarryShaw JarryShaw changed the title ci(milestone): set the release milestone when an issue or PR closes (#2218) ci(milestone): set the release milestone on issues and PRs (#2218) Oct 26, 2026
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 26, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 95feb5679 (Sonnet delta review of 86dbdad92→95feb5679, set-on-open per #2218).

  • Triggers: [opened, reopened, closed] on both events. A fork PR's opened still checks out only github.sha (base) with persist-credentials: false, and only the number passes through env. Concurrency is per item with queue: max, so a burst cannot starve other items.
  • Rule: set on an open item, a merged PR or a completed issue. remove on unmerged, not-planned or duplicate. No change on a close with no reason.
  • Precedence: set writes only when the item holds no milestone. A different milestone is kept and logged, so no path overwrites a hand-set later release. remove takes whatever the item holds.
  • Backfill: state=all&milestone=none, with the same bound. Dry-run writes nothing.
  • Tests: 49 passed in test_milestone_2218.py, and 247 passed in the workflow-wide selection. Fail-without-fix: 16 failed against 86dbdad92.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.56% (unit tier, Python 3.15, 95feb5679, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 881 2618 867 92.11%
pcapkit/corekit 2589 74 816 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2994 23 1038 25 98.81%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17433 218 4584 185 98.15%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 504 7 146 5 98.15%
pcapkit/vendor 4432 1988 1018 167 51.87%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at 95feb5679. Closes #2218.

@JarryShaw
JarryShaw merged commit 91147a1 into main Oct 26, 2026
64 checks passed
@JarryShaw
JarryShaw deleted the ci/2218-milestone-on-close branch October 26, 2026 03:12
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 26, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Pull requests that change CI or workflow configuration (ci: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ci: set milestones automatically on close

1 participant