Skip to content

Commit aa34c19

Browse files
authored
chore: Adding workflows (#43)
1 parent feaaa47 commit aa34c19

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed

.github/workflows/issue_closed.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Issue Closed
2+
3+
on:
4+
issues:
5+
types: [closed]
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
cleanup-labels:
12+
runs-on: ubuntu-latest
13+
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')) }}
14+
steps:
15+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
16+
- name: remove unnecessary labels after closing
17+
shell: bash
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
ISSUE_NUMBER: ${{ github.event.issue.number }}
21+
run: |
22+
gh issue edit $ISSUE_NUMBER --remove-label "closing soon" --remove-label "pending-response" --remove-label "pending-release"
23+
24+
comment-visibility-warning:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: aws-actions/closed-issue-message@v1
28+
with:
29+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
30+
message: |
31+
This issue is now closed. Comments on closed issues are hard for our team to see.
32+
If you need more assistance, please open a new issue that references this one.
33+
If you wish to keep having a conversation with other community members under this issue feel free to do so.

.github/workflows/issue_comment.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Issue Comment
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
notify:
9+
runs-on: ubuntu-latest
10+
permissions: {}
11+
if: ${{ !github.event.issue.pull_request && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) }}
12+
steps:
13+
- name: Run webhook curl command
14+
env:
15+
WEBHOOK_URL: ${{ secrets.SLACK_COMMENT_WEBHOOK_URL }}
16+
COMMENT: ${{toJson(github.event.comment.body)}}
17+
USER: ${{github.event.comment.user.login}}
18+
COMMENT_URL: ${{github.event.comment.html_url}}
19+
shell: bash
20+
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'"}'
21+
22+
remove-pending-response-label:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
issues: write
26+
if: ${{ !github.event.issue.pull_request && contains(github.event.issue.labels.*.name, 'pending-response') }}
27+
steps:
28+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
29+
- name: remove unnecessary labels after closing
30+
shell: bash
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
ISSUE_NUMBER: ${{ github.event.issue.number }}
34+
run: |
35+
gh issue edit $ISSUE_NUMBER --remove-label "pending-response"

.github/workflows/issue_opened.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Issue Opened
2+
on:
3+
issues:
4+
types: [opened]
5+
6+
jobs:
7+
notify:
8+
runs-on: ubuntu-latest
9+
permissions: {}
10+
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }}
11+
steps:
12+
- name: Run webhook curl command
13+
env:
14+
WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }}
15+
ISSUE: ${{toJson(github.event.issue.title)}}
16+
ISSUE_URL: ${{github.event.issue.html_url}}
17+
USER: ${{github.event.issue.user.login}}
18+
shell: bash
19+
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'"}'
20+
21+
maintainer-opened:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
issues: write
25+
if: ${{ contains(fromJSON('["MEMBER", "OWNER"]'), github.event.issue.author_association) }}
26+
steps:
27+
- name: Post comment if maintainer opened.
28+
shell: bash
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
ISSUE_NUMBER: ${{ github.event.issue.number }}
32+
run: |
33+
gh issue comment $ISSUE_NUMBER --repo aws-amplify/amplify-swift-utils-notifications -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."

.github/workflows/notify_release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Notify Release
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions: {}
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Run webhook curl command
14+
env:
15+
WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_WEBHOOK_URL }}
16+
VERSION: ${{github.event.release.html_url}}
17+
REPO_NAME: ${{github.event.repository.name}}
18+
ACTION_NAME: ${{github.event.action}}
19+
shell: bash
20+
run: echo $VERSION | xargs -I {} curl -s POST "$WEBHOOK_URL" -H "Content-Type:application/json" --data '{"action":"'$ACTION_NAME'", "repo":"'$REPO_NAME'", "version":"{}"}'

0 commit comments

Comments
 (0)