Skip to content

Close Milestone and Notify Slack #5

Close Milestone and Notify Slack

Close Milestone and Notify Slack #5

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:
- name: Close Milestone
run: |
TAG=${{ inputs.releaseTag }}
MILESTONE_NAME=${TAG#v}
MILESTONE_ID="$(gh api repos/$OWNER/$REPO/milestones --jq '.[] | select(.title == "$MILESTONE_NAME") | .number')"
if [ $MILESTONE_ID ]; then
gh api -X PATCH repos/$OWNER/$REPO/milestones/$MILESTONE_ID -f state='closed'
fi
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}