Skip to content

Commit

Permalink
feat: Add milestone create output milestone number support (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer authored Oct 26, 2024
1 parent 1aae167 commit f5c244b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
name: Create Milestone
steps:
- name: Create Milestone
id: create
uses: hustcer/milestone-action@develop
with:
action: create
Expand All @@ -34,3 +35,16 @@ jobs:
description: ${{ github.event.inputs.description }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output Milestone Number
if: success()
run: |
echo "The new milestone number is ${{ steps.create.outputs.milestone-number }}"
- name: Debug Output
if: failure()
run: |
echo "Failed to create milestone"
echo "Title: ${{ github.event.inputs.title }}"
echo "Due Date: ${{ github.event.inputs.due-on }}"
echo "Description: ${{ github.event.inputs.description }}"
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ inputs:
default: '${{ github.token }}'
description: 'The GITHUB_TOKEN secret or personal access token to authenticate. Defaults to `github.token`.'

outputs:
milestone-number:
description: 'The number of the milestone created or set.'

runs:
using: 'composite'
steps:
Expand Down
2 changes: 2 additions & 0 deletions nu/milestone.nu
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ export def create-milestone [
let result = gh api -X POST $'/repos/($repo)/milestones' -F $'title=($title)' ...$dueOnArg ...$descArg
let milestone = $result | from json
print $'Milestone (ansi p)($milestone.title)(ansi reset) with NO. (ansi p)($milestone.number)(ansi reset) was created successfully.'
print 'Set output for milestone create Github Action:'
echo $'milestone-number=($milestone.number)' | save --append $env.GITHUB_OUTPUT
}

# Close milestone for a repository by title or number.
Expand Down

0 comments on commit f5c244b

Please sign in to comment.