File tree Expand file tree Collapse file tree 4 files changed +37
-0
lines changed
Expand file tree Collapse file tree 4 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 8383- `working_dir` AWS CDK working directory. (default : ' .' )
8484- `actions_comment` Whether or not to comment on pull requests. (default : true)
8585
86+ # # Outputs
87+
88+ - ` status_code` Returned status code.
89+
8690# # ENV
8791
8892- ` AWS_ACCESS_KEY_ID` **Required**
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ inputs:
2020 actions_comment :
2121 description : ' Whether or not to comment on pull requests.'
2222 default : true
23+ outputs :
24+ status_code :
25+ description : ' Returned status code.'
2326runs :
2427 using : ' docker'
2528 image : ' ./Dockerfile'
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ function runCdk(){
4545 echo " Run cdk ${INPUT_CDK_SUBCOMMAND} ${* } \" ${INPUT_CDK_STACK} \" "
4646 output=$( cdk ${INPUT_CDK_SUBCOMMAND} ${* } " ${INPUT_CDK_STACK} " 2>&1 )
4747 exitCode=${?}
48+ echo ::set-output name=status_code::${exitCode}
4849 echo " ${output} "
4950
5051 commentStatus=" Failed"
Original file line number Diff line number Diff line change 1+ # If Stack has difference, notify to slack
2+
3+ on : [pull_request]
4+
5+ jobs :
6+ aws_cdk :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - name : cdk diff
10+ id : diff
11+ uses : youyo/aws-cdk-github-actions@master
12+ with :
13+ cdk_subcommand : ' diff'
14+ actions_comment : true
15+ env :
16+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
17+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
18+ AWS_DEFAULT_REGION : ' ap-northeast-1'
19+
20+ # https://github.com/marketplace/actions/action-slack
21+ - name : notify slack
22+ uses : 8398a7/action-slack@v2
23+ with :
24+ status : ${{ job.status }}
25+ author_name : GitHubActions
26+ env :
27+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
29+ if : ${{ steps.diff.outputs.status_code }} == 1
You can’t perform that action at this time.
0 commit comments