This action adds the current milestone by due date, or the milestone with the farthest due date to issues and pull requests. By default, the action ignores closed milestones, milestones with no due date, and milestones that are past due. This suits repos that have multiple open milestones with different due dates, and a few milestones with no due dates (e.g. "backburner" and "stalled").
Alternatively, enable the single
option if your repo only has one milestone
open at a time. When enabled, the only open milestone will be added to issues
and pull requests, even if it doesn't have a due date.
Here are successful test runs for current and farthest due milestones.
# .github/workflows/add-milestone.yml
name: Add Milestone
on:
issues:
types: [opened]
pull_request:
types: [closed]
branches: [main]
jobs:
add:
runs-on: ubuntu-latest
steps:
- uses: benelan/milestone-action@v3
with:
# If true, add the milestone with the farthest due date. By default,
# the action adds the current milestone (closest due date).
farthest: false
# If true, overwrite existing milestones on issues and pull requests.
# By default, the action exits if a milestone has already been added.
overwrite: false
# If true, add the only open milestone in a repo, even if there is no
# due date. By default, milestones with no due date are ignored.
single: false
3.1.0 (2024-02-10)
- Add
single
option for repos that have one open milestone at a time with no due date. (47e7b58)
3.0.0 (2024-01-24)
- Upgrade the Node runner to
v20
, which is the current LTS version. Nodev16
reached end of life on2023-09-11
and the GitHub runner will be deprecated this year. See this GitHub blog post for more info. (e845696)
- Use GitHub Action annotations
instead of
console.log
(4a7383b)
2.0.0 (2022-12-24)
- Upgrade the Node runner from the deprecated
v12
tov16
. See this GitHub blog post for more info (f5f6fcb)
1.3.1 (2022-04-26)
- A milestone is considered current until the day after it is due date. Previously, it was considering the time of day the milestone was created when comparing the current date to the due date (c68adeb)
1.3.0 (2022-04-26)
- Add
overwrite
option to add the milestone even if one already exists on the issue or pull request (7ad020e)
1.2.0 (2022-04-25)
- Allow the workflow to run on any event action (9bce688)
1.1.1 (2021-09-21)
- Skip action when the sender is dependabot. See this GitHub blog post for more info (e0a0717)
1.1.0 (2021-09-13)
- Add
farthest
option to add the milestone with the farthest due date (9ac638a)