@@ -8,55 +8,45 @@ permissions:
88 contents : read
99
1010jobs :
11- log-event :
12- name : Log event
11+ generate-sandbox-name :
12+ name : Generate sandbox name
1313 runs-on : ubuntu-latest
14+ outputs :
15+ SANDBOX_NAME : ${{ steps.calc-sbx-name.outputs.SANDBOX_NAME }}
1416 timeout-minutes : 5
1517 steps :
1618 - name : Check out the repository
1719 uses : actions/checkout@v4
18- - name : " Log event"
20+ - id : calc-sbx-name
21+ name : Calculate sandbox name
1922 run : |
20- echo number${{ github.event.number }}
21- echo action${{ github.event.action }}
22- echo pull_request${{ github.event.pull_request }}
23- echo push${{ github.event.push }}
24- echo issue${{ github.event.issue }}
25- echo workflow${{ github.workflow }}
26- echo ref${{ github.ref }}
27- echo repository${{ github.repository }}
28- echo id${{ github.event.id }}
29- echo event${{ github.event }}
30- echo github${{ github }}
31- echo event_name${{ github.event_name }}
32- echo '${{ toJson(github) }}'
3323 REF=${{ github.ref }}
3424 echo "REF=$REF"
3525 SANDBOX_NAME=$(./scripts/sandbox-utils.sh "$REF")
3626 echo "SANDBOX_NAME=$SANDBOX_NAME"
37- echo "BEFORE: $GITHUB_ENV"
38- cat $GITHUB_ENV
39- echo "SANDBOX_NAME=$SANDBOX_NAME" >> $GITHUB_ENV
40- echo "AFTER: $GITHUB_ENV"
41- cat $GITHUB_ENV
27+ echo "SANDBOX_NAME=$SANDBOX_NAME" >> $GITHUB_OUTPUT
28+
4229
4330 sandbox-set-up :
4431 name : Step 1
32+ needs : generate-sandbox-name
4533 uses : ./.github/workflows/dispatch_internal_repo_workflow.yaml
4634 secrets : inherit
4735 with :
4836 jobName : Sandbox set up
4937 infraRepoName : nhs-notify-web-template-management
5038 releaseVersion : ${{ github.head_ref || github.ref_name }}
5139 targetWorkflow : dispatch-deploy-dynamic-env.yaml
52- targetEnvironment : pr ${{ github.event.number }}
40+ targetEnvironment : ${{ needs.generate-sandbox-name.outputs.SANDBOX_NAME }}
5341 targetAccountGroup : nhs-notify-template-management-dev
5442 targetComponent : sandbox
5543 terraformAction : apply
5644
5745 acceptance-tests :
5846 name : Step 2
59- needs : sandbox-set-up
47+ needs :
48+ - sandbox-set-up
49+ - generate-sandbox-name
6050
6151 # Calls out to the nhs-notify-internal repo.
6252 # The nhs-notify-internal repo will run the tests
@@ -68,13 +58,15 @@ jobs:
6858 infraRepoName : nhs-notify-web-template-management
6959 releaseVersion : ${{ github.head_ref || github.ref_name }}
7060 targetWorkflow : dispatch-acceptance-tests-dynamic-env.yaml
71- targetEnvironment : pr ${{ github.event.number }}
61+ targetEnvironment : ${{ needs.generate-sandbox-name.outputs.SANDBOX_NAME }}
7262 targetAccountGroup : nhs-notify-template-management-dev
7363 targetComponent : sandbox
7464
7565 sandbox-tear-down :
7666 name : Step 3
77- needs : acceptance-tests
67+ needs :
68+ - acceptance-tests
69+ - generate-sandbox-name
7870 if : always()
7971
8072 uses : ./.github/workflows/dispatch_internal_repo_workflow.yaml
8476 infraRepoName : nhs-notify-web-template-management
8577 releaseVersion : ${{ github.head_ref || github.ref_name }}
8678 targetWorkflow : dispatch-deploy-dynamic-env.yaml
87- targetEnvironment : pr ${{ github.event.number }}
79+ targetEnvironment : ${{ needs.generate-sandbox-name.outputs.SANDBOX_NAME }}
8880 targetAccountGroup : nhs-notify-template-management-dev
8981 targetComponent : sandbox
9082 terraformAction : destroy
0 commit comments