Skip to content

Close Milestone and Notify Slack #8

Close Milestone and Notify Slack

Close Milestone and Notify Slack #8

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