Skip to content

Commit

Permalink
feat: attempt to trigger terraform automatically after be
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Smith committed Mar 2, 2024
1 parent 2c31697 commit a601456
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
branches:
- 'main'
workflow_dispatch:
workflow_run:
workflows: [Terraform] # Name of GitHub workflow to trigger in target repository
types:
- completed

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -46,3 +50,17 @@ jobs:

- name: Copy GraphQL schema to S3
run: aws s3 cp --content-type text/plain schema.graphql s3://d2e-lambda-s3-bucket
trigger-terraform-workflow:
if: github.event.workflow_run.conclusion == 'success' # Run only when workflow run has succeeded, i.e. all jobs have succeeded
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT }} # Fine-grained GitHub PAT that was saved as repository secret
script: |
await github.rest.actions.createworkflowDispatch({
owner: 'CapgeminiInventUK',
repo: 'donate-to-educate-terraform',
workflow_id: 'terraform.yml',
ref: 'main'
})

0 comments on commit a601456

Please sign in to comment.