From b0edc15d7b5de952de1aa245e546e65507579502 Mon Sep 17 00:00:00 2001 From: Ben Evans <49054298+bsanevans@users.noreply.github.com> Date: Tue, 30 Apr 2024 16:57:03 +0900 Subject: [PATCH] Create published-content.yml Adds workflow to add/remove labels on published content. --- .github/workflows/published-content.yml | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/published-content.yml diff --git a/.github/workflows/published-content.yml b/.github/workflows/published-content.yml new file mode 100644 index 000000000..bc403621a --- /dev/null +++ b/.github/workflows/published-content.yml @@ -0,0 +1,41 @@ +# This workflow is based on the Community Team's similar workflow +# https://github.com/WordPress/Community-Team/blob/trunk/.github/workflows/close-issue-on-publish.yml + +name: Close and label issue when content is marked as published + +on: + issue_comment: + types: [created, edited] + +jobs: + publish-commment: + runs-on: ubuntu-latest + if: contains(github.event.comment.body, '//publish') + steps: + - name: Remove co-host label + if: contains(github.event.issue.labels.*.name, '[Content] Needs Co-host') + shell: bash + run: | + gh issue edit -R "${{ github.repository }}" \ + --remove-label "[Content] Needs Co-host" \ + "${{ github.event.issue.number }}" + env: + GH_TOKEN: ${{ github.token }} + + - name: Add published labels + shell: bash + run: | + gh issue edit -R "${{ github.repository }}" \ + --add-label "[Content] Published" \ + "${{ github.event.issue.number }}" + env: + GH_TOKEN: ${{ github.token }} + + - name: Close Issue + shell: bash + run: | + gh issue close -R "${{ github.repository }}" \ + --reason "completed" \ + "${{ github.event.issue.number }}" + env: + GH_TOKEN: ${{ github.token }}