Skip to content

A GitHub Action that automatically adds the current or farthest due milestone to pull requests and issues.

License

Notifications You must be signed in to change notification settings

benelan/milestone-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

milestone-action status

Add Milestone By Due Date

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.

Usage

# .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

Changelog

3.1.0 (2024-02-10)

Features

  • Add single option for repos that have one open milestone at a time with no due date. (47e7b58)

3.0.0 (2024-01-24)

Breaking Changes

  • Upgrade the Node runner to v20, which is the current LTS version. Node v16 reached end of life on 2023-09-11 and the GitHub runner will be deprecated this year. See this GitHub blog post for more info. (e845696)

Features

2.0.0 (2022-12-24)

Breaking Changes

1.3.1 (2022-04-26)

Fixes

  • 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)

Features

  • 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)

Features

  • Allow the workflow to run on any event action (9bce688)

1.1.1 (2021-09-21)

Fixes

1.1.0 (2021-09-13)

Features

  • Add farthest option to add the milestone with the farthest due date (9ac638a)