From 4d02785beb23381023ac175fc3a59f1a1a1ad63b Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Sat, 26 Oct 2024 08:41:24 +0800 Subject: [PATCH] feat: Output the milestone number after creating it (#85) --- .github/workflows/create.yml | 4 ++++ nu/milestone.nu | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index 561a950..3214799 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -25,6 +25,7 @@ jobs: name: Create Milestone steps: - name: Create Milestone + id: create uses: hustcer/milestone-action@develop with: action: create @@ -34,3 +35,6 @@ jobs: description: ${{ github.event.inputs.description }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Output Milestone Number + run: echo "The new milestone number is ${{ steps.create.outputs.milestone_number }}" diff --git a/nu/milestone.nu b/nu/milestone.nu index 981ddd8..ef525c4 100644 --- a/nu/milestone.nu +++ b/nu/milestone.nu @@ -181,6 +181,9 @@ 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.' + if 'GITHUB_OUTPUT' in $env { + echo $'milestone_number=($milestone.number)' o>> $env.GITHUB_OUTPUT + } } # Close milestone for a repository by title or number.