Creates a milestone with the given title in a GitHub repository if one does not already exist. The step is idempotent — if a milestone with the same title is already present it logs the existing number and exits cleanly.
| Name | Required | Description |
|---|---|---|
repo |
yes | Full repository path (e.g. spring-cloud/spring-cloud-config-commercial) |
version |
yes | Milestone title / version string (e.g. 5.0.2.1) |
token |
yes | GitHub token with repo scope (needs milestone write access) |
- name: Checkout
uses: actions/checkout@v4
- name: Create milestone if missing
uses: ./.github/actions/create-milestone
with:
repo: spring-cloud/spring-cloud-config-commercial
version: ${{ steps.setup.outputs.release-version }}
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}Or from a reusable action reference:
- name: Create milestone if missing
uses: spring-cloud/spring-cloud-github-actions/.github/actions/create-milestone@v1
with:
repo: spring-cloud/spring-cloud-config-commercial
version: 5.0.2.1
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}- The
versioninput is used as the milestone title exactly as supplied — novprefix is added. - Milestones are read with
--paginateandstate=all. Both matter: titles are not unique, the defaultstate=openhides an already-closed milestone with the same title, and repositories past a hundred milestones return the newest ones on a later page. - A lookup that fails, fails the step. The listing is captured and its exit status checked before anything is created: a rate limit, a 5xx, or a token that cannot read the repository would otherwise be indistinguishable from "no such milestone", and creating while blind is the only way this action can produce a duplicate.
- Titles are compared with surrounding whitespace trimmed, so a milestone titled
2026.0.0-M1counts as the existing2026.0.0-M1rather than being duplicated. - A repository that already has more than one milestone with the requested title gets a warning naming every number. Nothing is created, and nothing here tries to merge them.
- The token must have write access to the target repository's issues (the
reposcope on a classic PAT, orissues: writeon a fine-grained PAT).