diff --git a/.github/workflows/cleanup_labels_issue_close.yml b/.github/workflows/cleanup_labels_issue_close.yml deleted file mode 100644 index 84be33bad6..0000000000 --- a/.github/workflows/cleanup_labels_issue_close.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Removes pending-response and closing-soon labels when an issue is closed. - -name: Cleanup Labels on Issue Close - -on: - issues: - types: [closed] - -permissions: - issues: write - -jobs: - cleanup: - name: Remove labels - runs-on: ubuntu-latest - if: ${{ !github.event.issue.pull_request && (contains(github.event.issue.labels.*.name, 'pending-response') || contains(github.event.issue.labels.*.name, 'closing soon') || contains(github.event.issue.labels.*.name, 'pending-release')) }} - - steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b - - name: remove unnecessary labels after closing - shell: bash - env: - 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" diff --git a/.github/workflows/closed_issue_message.yml b/.github/workflows/closed_issue_message.yml deleted file mode 100644 index a07fc9b14e..0000000000 --- a/.github/workflows/closed_issue_message.yml +++ /dev/null @@ -1,21 +0,0 @@ - -name: Closed Issue Message -on: - issues: - types: [closed] - -permissions: - issues: write - -jobs: - auto_comment: - runs-on: ubuntu-latest - steps: - - uses: aws-actions/closed-issue-message@v1 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - message: | - ### ⚠️COMMENT VISIBILITY WARNING⚠️ - Comments on closed issues are hard for our team to see. - If you need more assistance, please either tag a team member or 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. diff --git a/.github/workflows/issue_closed.yml b/.github/workflows/issue_closed.yml new file mode 100644 index 0000000000..929ad0ebf2 --- /dev/null +++ b/.github/workflows/issue_closed.yml @@ -0,0 +1,34 @@ +name: Issue Closed + +on: + issues: + types: [closed] + +permissions: + issues: write + +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')) }} + 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 }} + run: | + gh issue edit $ISSUE_NUMBER --remove-label "closing soon" --remove-label "pending-response" --remove-label "pending-release" + + comment-visibility-warning: + runs-on: ubuntu-latest + steps: + - uses: aws-actions/closed-issue-message@v1 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + message: | + ### ⚠️COMMENT VISIBILITY WARNING⚠️ + Comments on closed issues are hard for our team to see. + If you need more assistance, please either tag a team member or 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. diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml new file mode 100644 index 0000000000..55c66ea87e --- /dev/null +++ b/.github/workflows/issue_comment.yml @@ -0,0 +1,35 @@ +name: Issue Comment + +on: + issue_comment: + types: [created] + +jobs: + notify: + runs-on: ubuntu-latest + permissions: {} + if: ${{ !github.event.issue.pull_request && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }} + steps: + - name: Run webhook curl command + env: + WEBHOOK_URL: ${{ secrets.SLACK_COMMENT_WEBHOOK_URL }} + COMMENT: ${{toJson(github.event.comment.body)}} + USER: ${{github.event.comment.user.login}} + COMMENT_URL: ${{github.event.comment.html_url}} + 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: + runs-on: ubuntu-latest + permissions: + issues: write + if: ${{ !github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'pending-response') }} + 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 }} + run: | + gh issue edit $ISSUE_NUMBER --remove-label "pending-response" \ No newline at end of file diff --git a/.github/workflows/issue_opened.yml b/.github/workflows/issue_opened.yml new file mode 100644 index 0000000000..7ea510ba0e --- /dev/null +++ b/.github/workflows/issue_opened.yml @@ -0,0 +1,33 @@ +name: Issue Opened +on: + issues: + types: [opened] + +jobs: + notify: + runs-on: ubuntu-latest + permissions: {} + if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }} + steps: + - name: Run webhook curl command + env: + WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }} + ISSUE: ${{toJson(github.event.issue.title)}} + ISSUE_URL: ${{github.event.issue.html_url}} + USER: ${{github.event.issue.user.login}} + 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'"}' + + maintainer-opened: + runs-on: ubuntu-latest + permissions: + issues: write + if: ${{ contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }} + steps: + - name: Post comment if maintainer opened. + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + 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." diff --git a/.github/workflows/new_issue_maintainer.yml b/.github/workflows/new_issue_maintainer.yml deleted file mode 100644 index 188fce06b2..0000000000 --- a/.github/workflows/new_issue_maintainer.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: New Issue by Maintainer - -on: - issues: - types: [opened] - -permissions: - issues: write - -jobs: - maintainer-opened: - runs-on: ubuntu-latest - if: ${{ !github.event.issue.pull_request && contains(fromJSON('["palpatim", "5d", "jcjimenez", "lawmicha", "harsh62", "thisisabhash", "royjit", "atierian", "ukhan-amazon", "ruisebas", "phantumcode"]'), github.event.issue.user.login) }} - steps: - - name: add message if maintainer opened - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_NUMBER: ${{ github.event.issue.number }} - run: | - gh issue comment $ISSUE_NUMBER --repo aws-amplify/amplify-ios -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." diff --git a/.github/workflows/notify_new_issue.yml b/.github/workflows/notify_new_issue.yml deleted file mode 100644 index 2c32e33645..0000000000 --- a/.github/workflows/notify_new_issue.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Notify New Issues - -# Controls when the workflow will run -on: - # Triggers the workflow on comment events on pending response issues - issues: - types: [opened] - -# Limit the GITHUB_TOKEN permissions -permissions: {} - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "notify" - notify: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Exclude issues opened by maintainers - if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }} - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Runs a single command using the runners shell - - name: Run webhook curl command - env: - WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }} - ISSUE: ${{toJson(github.event.issue.title)}} - ISSUE_URL: ${{github.event.issue.html_url}} - USER: ${{github.event.issue.user.login}} - 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'"}'