diff --git a/.github/workflows/cicd-1-pull-request.yaml b/.github/workflows/cicd-1-pull-request.yaml index 1df34a0a7..a44b4ddfe 100644 --- a/.github/workflows/cicd-1-pull-request.yaml +++ b/.github/workflows/cicd-1-pull-request.yaml @@ -108,6 +108,7 @@ jobs: terraform_version: "${{ needs.metadata.outputs.terraform_version }}" version: "${{ needs.metadata.outputs.version }}" secrets: inherit + test-stage: # Recommended maximum execution time is 5 minutes name: "Test stage" needs: [metadata, dependencies, commit-stage] @@ -121,9 +122,31 @@ jobs: terraform_version: "${{ needs.metadata.outputs.terraform_version }}" version: "${{ needs.metadata.outputs.version }}" secrets: inherit + + pr-create-dynamic-environment: + name: Create Dynamic Environment + needs: [metadata, dependencies, commit-stage] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5.0.0 + - name: Trigger dynamic environment creation + env: + APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }} + APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }} + shell: bash + run: | + .github/scripts/dispatch_internal_repo_workflow.sh \ + --infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \ + --releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \ + --targetWorkflow "dispatch-deploy-dynamic-env.yaml" \ + --targetEnvironment "pr${{ github.event.number }}" \ + --targetComponent "branch" \ + --targetAccountGroup "nhs-notify-template-management-dev" \ + --terraformAction "apply" \ + --overrides "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" acceptance-stage: # Recommended maximum execution time is 10 minutes name: "Acceptance stage" - needs: [metadata, dependencies, test-stage] + needs: [metadata, dependencies, test-stage, pr-create-dynamic-environment] uses: ./.github/workflows/stage-4-acceptance.yaml if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event_name == 'push' && github.ref == 'refs/heads/main') secrets: inherit diff --git a/.github/workflows/pr_create_dynamic_env.yaml b/.github/workflows/pr_create_dynamic_env.yaml deleted file mode 100644 index a8727da7d..000000000 --- a/.github/workflows/pr_create_dynamic_env.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: PR Create Environment - -on: - pull_request: - types: [labeled, opened, synchronize, reopened, unlabeled, edited] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: false - -permissions: - id-token: write - contents: read - -jobs: - create-dynamic-environment: - name: Create Dynamic Environment - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5.0.0 - - name: Trigger dynamic environment creation - env: - APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }} - APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }} - shell: bash - run: | - .github/scripts/dispatch_internal_repo_workflow.sh \ - --infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \ - --releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \ - --targetWorkflow "dispatch-deploy-dynamic-env.yaml" \ - --targetEnvironment "pr${{ github.event.number }}" \ - --targetComponent "branch" \ - --targetAccountGroup "nhs-notify-template-management-dev" \ - --terraformAction "apply" \ - --overrides "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"