-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathemit-comment-to-sns-github-action.yml
42 lines (38 loc) · 1.71 KB
/
emit-comment-to-sns-github-action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Emit issue comment to AWS SNS
'on':
issue_comment:
types:
- created
- edited
defaults:
run:
shell: bash
jobs:
emit_comment:
name: Emit issue comment to AWS SNS
runs-on: ubuntu-latest
env: # These values will be replaced by deploy.py with the actual values
BIRCH_GIRDER_SNS_TOPIC_REGION: region-goes-here
BIRCH_GIRDER_SNS_TOPIC_ARN: sns-topic-arn-goes-here
# If the user making the comment is the bot user, then don't trigger Birch Girder
# as the only time this happens is when Birch Girder adds a comment to an issue
if: github.event.comment.user.login != 'bot-name-goes-here' # This value will be replaced by deploy.py
timeout-minutes: 1
outputs:
message_id: ${{ steps.emit-comment.outputs.message_id }}
steps:
# You can uncomment this if you want to filter out a field from the GitHub issue comment
# This should not be used with Birch Girder as the entire issue comment event is needed
# - name: Extract issue comment message
# id: extract-comment
# run: jq -r .comment.body $GITHUB_EVENT_PATH > issue_comment_body.txt
- name: Configure AWS Credentials
id: configure-aws
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.BIRCH_GIRDER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.BIRCH_GIRDER_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.BIRCH_GIRDER_SNS_TOPIC_REGION }}
- name: Emit issue comment to AWS SNS
id: emit-comment
run: echo "::set-output name=message_id::$(aws sns publish --topic-arn $BIRCH_GIRDER_SNS_TOPIC_ARN --message file://$GITHUB_EVENT_PATH --output text --query MessageId)"