Skip to content

Close Milestone and Notify Slack #3

Close Milestone and Notify Slack

Close Milestone and Notify Slack #3

name: Close Milestone and Notify Slack
on:
workflow_dispatch:
inputs:
releaseTag:
description: 'The tag of the release for Milestone to close. Usually starts with `v`'
required: true
type: string
workflow_call:
inputs:
releaseTag:
description: 'The tag of the release for Milestone to close. Usually starts with `v`'
required: true
type: string
jobs:
close-milestone:
runs-on: ubuntu-latest
steps:
- id: get-milestone-from-tag
run: |
TAG=${{ inputs.releaseTag }}
echo milestoneName=${TAG#v} >> $GITHUB_OUTPUT
- uses: octokit/[email protected]
id: list_milestones
with:
route: GET /repos/${{ github.repository }}/milestones
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
- id: get-milestone-id
run: echo milestoneId='${{steps.list_milestones.outputs.data}}' | jq '.[] | select(.title == "${{steps.get-milestone-from-tag.outputs.milestoneName}}") | .number' >> $GITHUB_OUTPUT
- name: Close Milestone
if: ${{steps.get-milestone-id.outputs.milestoneId}}
uses: octokit/[email protected]
with:
route: PATCH /repos/${{ github.repository }}/milestones/${{steps.get-milestone-id.outputs.milestoneId}}
state: "closed"
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}