diff --git a/.github/workflows/issue-closed.yml b/.github/workflows/issue-closed.yml new file mode 100644 index 00000000000..1b96c8714c8 --- /dev/null +++ b/.github/workflows/issue-closed.yml @@ -0,0 +1,27 @@ +# Description: This workflow automatically removes triage labels from issues that have been closed +# +# Triggered by: closing issues + +name: Issue Closed + +on: + issues: + types: [closed] + +jobs: + clean_labels: + runs-on: ubuntu-latest + + permissions: + issues: write + + if: ${{ (contains(github.event.issue.labels.*.name, 'pending-community-response') || contains(github.event.issue.labels.*.name, 'pending-maintainer-response') || contains(github.event.issue.labels.*.name, 'pending-triage')) }} + steps: + - name: Remove unnecessary labels after closing + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + REPOSITORY_NAME: ${{ github.event.repository.full_name }} + run: | + gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --remove-label "pending-community-response" --remove-label "pending-maintainer-response" --remove-label "pending-triage" diff --git a/.github/workflows/issue-comment.yml b/.github/workflows/issue-comment.yml new file mode 100644 index 00000000000..6637bfd8e7f --- /dev/null +++ b/.github/workflows/issue-comment.yml @@ -0,0 +1,38 @@ +# Description: This workflow automatically adds appropriate labels to issues that have been commented on +# +# Triggered by: a new comment being added to an issue + +name: Issue Comment + +on: + issue_comment: + types: [created] + +jobs: + adjust_labels: + runs-on: ubuntu-latest + + permissions: + issues: write + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + REPOSITORY_NAME: ${{ github.event.repository.full_name }} + + steps: + - name: Remove pending-community-response when new community comment received + if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && !github.event.issue.pull_request }} + shell: bash + run: | + gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --remove-label "pending-community-response" + - name: Add pending-maintainer-response when new community comment received + if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }} + shell: bash + run: | + gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --add-label "pending-maintainer-response" + - name: Remove pending-maintainer-response when new owner/member comment received + if: ${{ contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }} + shell: bash + run: | + gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --remove-label "pending-maintainer-response" diff --git a/.github/workflows/label-new-issues.yml b/.github/workflows/label-new-issues.yml index 8a62b6ee063..877875f27cd 100644 --- a/.github/workflows/label-new-issues.yml +++ b/.github/workflows/label-new-issues.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017 - - name: Add pending-triage label + - name: Add pending-maintainer-response label shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -33,4 +33,4 @@ jobs: echo "Issue number must be a positive integer" exit 1 fi - gh issue edit $ISSUE_NUMBER_INT --add-label 'pending-triage' + gh issue edit $ISSUE_NUMBER_INT --add-label 'pending-maintainer-response'