From a60145663eaa089411154d952d129505f1360301 Mon Sep 17 00:00:00 2001 From: Ryan Smith Date: Sat, 2 Mar 2024 10:25:21 +0000 Subject: [PATCH] feat: attempt to trigger terraform automatically after be --- .github/workflows/deploy.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b02f491..abdba81 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 }} @@ -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' + })