Skip to content

Commit

Permalink
Update label actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjroach committed Aug 9, 2024
1 parent cfe0de0 commit 16e7e71
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/issue_closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:
jobs:
cleanup-labels:
runs-on: ubuntu-latest
if: ${{ (contains(github.event.issue.labels.*.name, 'pending-response') || contains(github.event.issue.labels.*.name, 'closing soon') || contains(github.event.issue.labels.*.name, 'pending-release')|| contains(github.event.issue.labels.*.name, 'pending-triage')) }}
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, 'closing soon') || contains(github.event.issue.labels.*.name, 'pending-release')|| contains(github.event.issue.labels.*.name, 'pending-triage')) }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: remove unnecessary labels after closing
Expand All @@ -19,7 +19,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
gh issue edit $ISSUE_NUMBER --remove-label "closing soon" --remove-label "pending-response" --remove-label "pending-release" --remove-label "pending-triage"
gh issue edit $ISSUE_NUMBER --remove-label "closing soon" --remove-label "pending-community-response" --remove-label "pending-maintainer-response" --remove-label "pending-release" --remove-label "pending-triage"
comment-visibility-warning:
runs-on: ubuntu-latest
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/issue_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,27 @@ jobs:
shell: bash
run: echo $BODY | xargs -I {} curl -s POST "$WEBHOOK_URL" -H "Content-Type:application/json" --data '{"body":"{}", "issue":"'$COMMENT_URL'", "user":"'$USER'"}'

remove-pending-response-label:
adjust-labels:
runs-on: ubuntu-latest
permissions:
issues: write
if: ${{ !github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'pending-response') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: remove unnecessary labels after closing
- name: remove pending-community-response when new 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 --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 --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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
gh issue edit $ISSUE_NUMBER --remove-label "pending-response"
gh issue edit $ISSUE_NUMBER --remove-label "pending-maintainer-response"
2 changes: 1 addition & 1 deletion .github/workflows/issue_labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
remove-pending-triage-label:
runs-on: ubuntu-latest
if: ${{ contains(fromJSON('["question", "bug", "feature-request", "improvement"]'), github.event.label.name) }}
if: ${{ contains(fromJSON('["question", "bug", "feature-request"]'), github.event.label.name) }}
permissions:
issues: write
steps:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/issue_opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,25 @@ jobs:
shell: bash
run: echo $ISSUE | sed 's/[^a-zA-Z0-9 &().,:]//g' | xargs -I {} curl -s POST "$WEBHOOK_URL" -H "Content-Type:application/json" --data '{"issue":"{}", "issueUrl":"'$ISSUE_URL'", "user":"'$USER'"}'

add-pending-triage-label:
add-issue-opened-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: Add the pending-triage label
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 --add-label "pending-triage"
- name: Add the pending-maintainer-response label
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }}
shell: bash
run: |
gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --add-label "pending-maintainer-response"

maintainer-opened:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
# PRs wont go stale
days-before-pr-stale: -1
# Issues with any of these labels are checked.
any-of-labels: "pending-response, closing soon"
any-of-labels: "pending-community-response, closing soon"

0 comments on commit 16e7e71

Please sign in to comment.