File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -39,4 +39,12 @@ curl -XPUT "https://api.github.com/repos/$GITHUB_ORG/$GITHUB_REPO/branches/$DEFA
3939 "restrictions": null
4040}'
4141
42+ # # Rerun github actions workflow, since the first time github action is ran there are no AWS credentials
43+ # # so it will always fail, begining of this script we inject the AWS credentials, therefore now we can rerun the workflow
44+ MOST_RECENT_RUN_ID=$( curl -XGET --url " https://api.github.com/repos/${GITHUB_ORG} /${GITHUB_REPO} /actions/runs" \
45+ --header " Authorization: token $GITHUB_ACCESS_TOKEN " --header ' Content-Type: application/json' | jq -r " .workflow_runs[0].id" )
46+ # # Triggering the rerun
47+ curl -XPOST --url " https://api.github.com/repos/${GITHUB_ORG} /${GITHUB_REPO} /actions/runs/${MOST_RECENT_RUN_ID} /rerun" \
48+ --header " Authorization: token $GITHUB_ACCESS_TOKEN " --header ' Content-Type: application/json'
49+
4250echo " Github actions environment variables setup successfully."
Original file line number Diff line number Diff line change @@ -33,12 +33,18 @@ jobs:
3333 build :
3434 needs : unit-test
3535 runs-on : ubuntu-latest
36+ env :
37+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
3638 steps :
3739 - uses : actions/checkout@v2
3840 - name : Set IMAGE_TAG as env
3941 run : |
4042 IMAGE_TAG=$(git rev-parse --short=7 ${{ github.sha }})
4143 echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
44+ - if : env.AWS_ACCESS_KEY_ID == null
45+ run : |
46+ echo "AWS Credentials not found, This is expected for the first run as the repo is provisioned then secrets are injected at a later step."
47+ exit 1
4248 - name : Configure AWS credentials
4349 uses : aws-actions/configure-aws-credentials@v1
4450 with :
Original file line number Diff line number Diff line change 77 },
88 "main" : <%if eq (index .Params `apiType`) "rest" %>"src/app.js", <% else %>"src/graphql.js",<% end %>
99 "scripts" : {
10- "test" : " echo \" Error: no test specified\" && exit 1 " ,
10+ "test" : " echo \" Error: no test specified\" && exit 0 " ,
1111 "lint" : " eslint src" ,
1212 "lint:fix" : " eslint src --fix" ,
1313 "format" : " prettier --write '**/*.js'"
You can’t perform that action at this time.
0 commit comments