diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index f4cb21a..1038da6 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -12,9 +12,14 @@ on: sha: description: Commit SHA to tag required: false + pr_number: + description: Release PR number to relabel after tagging + required: false permissions: contents: write + issues: write + pull-requests: write jobs: tag: @@ -63,3 +68,18 @@ jobs: git remote set-url origin "https://x-access-token:${PUSH_TOKEN}@github.com/${{ github.repository }}.git" git tag "$tag" "$TARGET_SHA" git push origin "$tag" + + - name: Mark release PR as tagged + if: github.event_name == 'pull_request_target' || github.event.inputs.pr_number != '' + env: + GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} + PR_NUMBER: ${{ github.event.inputs.pr_number || github.event.pull_request.number }} + run: | + gh api "repos/${{ github.repository }}/labels" \ + -X POST \ + -f name='autorelease: tagged' \ + -f color='0e8a16' \ + -f description='Release PR has been tagged' >/dev/null 2>&1 || true + + gh api "repos/${{ github.repository }}/issues/${PR_NUMBER}/labels/autorelease:%20pending" -X DELETE >/dev/null 2>&1 || true + gh issue edit "${PR_NUMBER}" --add-label 'autorelease: tagged'