From fd77172f24dfdca19c515871fa213bffc04d2b96 Mon Sep 17 00:00:00 2001 From: tjroach Date: Mon, 12 Aug 2024 09:57:03 -0400 Subject: [PATCH 1/3] Update label actions --- .github/workflows/issue_closed.yml | 8 ++++---- .github/workflows/issue_comment.yml | 28 +++++++++++++++++++--------- .github/workflows/issue_labeled.yml | 20 ++++++++++++++++++++ .github/workflows/issue_opened.yml | 23 ++++++++++++++++++++++- 4 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/issue_labeled.yml diff --git a/.github/workflows/issue_closed.yml b/.github/workflows/issue_closed.yml index 822ba28996..5bb579e9ab 100644 --- a/.github/workflows/issue_closed.yml +++ b/.github/workflows/issue_closed.yml @@ -10,16 +10,16 @@ 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')) }} + 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 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 --remove-label "closing soon" --remove-label "pending-response" --remove-label "pending-release" + gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --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 @@ -30,4 +30,4 @@ jobs: message: | This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. - If you wish to keep having a conversation with other community members under this issue feel free to do so. + If you wish to keep having a conversation with other community members under this issue feel free to do so. \ No newline at end of file diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml index 55c66ea87e..e35aa08b74 100644 --- a/.github/workflows/issue_comment.yml +++ b/.github/workflows/issue_comment.yml @@ -8,7 +8,7 @@ jobs: notify: runs-on: ubuntu-latest permissions: {} - if: ${{ !github.event.issue.pull_request && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }} + if: ${{ !github.event.issue.pull_request }} steps: - name: Run webhook curl command env: @@ -19,17 +19,27 @@ jobs: shell: bash run: echo $COMMENT | sed "s/\\\n/. /g; s/\\\r//g; s/[^a-zA-Z0-9 &().,:]//g" | xargs -I {} curl -s POST "$WEBHOOK_URL" -H "Content-Type:application/json" --data '{"comment":"{}", "commentUrl":"'$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 }} + REPOSITORY_NAME: ${{ github.event.repository.full_name }} 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 --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 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_NUMBER: ${{ github.event.issue.number }} run: | - gh issue edit $ISSUE_NUMBER --remove-label "pending-response" \ No newline at end of file + gh issue edit $ISSUE_NUMBER --repo $REPOSITORY_NAME --remove-label "pending-maintainer-response" diff --git a/.github/workflows/issue_labeled.yml b/.github/workflows/issue_labeled.yml new file mode 100644 index 0000000000..cdf0657162 --- /dev/null +++ b/.github/workflows/issue_labeled.yml @@ -0,0 +1,20 @@ +name: Issue Labeled +on: + issues: + types: [labeled] + +jobs: + remove-pending-triage-label: + runs-on: ubuntu-latest + if: ${{ contains(fromJSON('["question", "bug", "feature-request"]'), github.event.label.name) }} + permissions: + issues: write + steps: + - name: Remove 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 --remove-label "pending-triage" \ No newline at end of file diff --git a/.github/workflows/issue_opened.yml b/.github/workflows/issue_opened.yml index 7ea510ba0e..9dc25e7ebd 100644 --- a/.github/workflows/issue_opened.yml +++ b/.github/workflows/issue_opened.yml @@ -18,6 +18,26 @@ 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-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 + 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 permissions: @@ -29,5 +49,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE_NUMBER: ${{ github.event.issue.number }} + REPOSITORY_NAME: ${{ github.event.repository.full_name }} run: | - gh issue comment $ISSUE_NUMBER --repo aws-amplify/amplify-swift -b "This issue was opened by a maintainer of this repository; updates will be posted here. If you are also experiencing this issue, please comment here with any relevant information so that we're aware and can prioritize accordingly." + gh issue comment $ISSUE_NUMBER --repo $REPOSITORY_NAME -b "This issue was opened by a maintainer of this repository; updates will be posted here. If you are also experiencing this issue, please comment here with any relevant information so that we're aware and can prioritize accordingly." \ No newline at end of file From 0d8b7ff831cbb0f29237182e60b77492faed2f9c Mon Sep 17 00:00:00 2001 From: tjroach Date: Mon, 12 Aug 2024 12:13:43 -0400 Subject: [PATCH 2/3] remove issue_labeled --- .github/workflows/issue_labeled.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/issue_labeled.yml diff --git a/.github/workflows/issue_labeled.yml b/.github/workflows/issue_labeled.yml deleted file mode 100644 index cdf0657162..0000000000 --- a/.github/workflows/issue_labeled.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Issue Labeled -on: - issues: - types: [labeled] - -jobs: - remove-pending-triage-label: - runs-on: ubuntu-latest - if: ${{ contains(fromJSON('["question", "bug", "feature-request"]'), github.event.label.name) }} - permissions: - issues: write - steps: - - name: Remove 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 --remove-label "pending-triage" \ No newline at end of file From 9411865b3352207ab10f3dcb0e14b96f8cc9950d Mon Sep 17 00:00:00 2001 From: tjroach Date: Mon, 12 Aug 2024 13:58:08 -0400 Subject: [PATCH 3/3] update issue_comment --- .github/workflows/issue_comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml index e35aa08b74..822ff84a1c 100644 --- a/.github/workflows/issue_comment.yml +++ b/.github/workflows/issue_comment.yml @@ -8,7 +8,7 @@ jobs: notify: runs-on: ubuntu-latest permissions: {} - if: ${{ !github.event.issue.pull_request }} + if: ${{ !github.event.issue.pull_request && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }} steps: - name: Run webhook curl command env: