A GitHub Action that automatically adds the current or farthest due milestone to pull requests and issues.
MIT License
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
single
option for repos that have one open milestone at a time with nov20
, which is the current LTS version. Node v16
2023-09-11
and the GitHub runner will be deprecated this year. See thisconsole.log
v12
to v16
. See thisoverwrite
option to add the milestone even if one already exists on thefarthest
option to add the milestone with the farthest due date