From 226d04170f84f4573e45890ff0aa527c24d5f360 Mon Sep 17 00:00:00 2001 From: Sean Rankine Date: Tue, 1 Nov 2022 16:18:04 +0000 Subject: [PATCH 1/2] Fix run-name for deploy workflow This updates the variable references to account for when the workflow is triggered by a CI workflow run. In that scenario the "inputs" context is blank and leads to empty strings. --- .github/workflows/deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 3141c9d2d..7c86a556b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,6 +1,6 @@ name: Deploy -run-name: Deploy ${{ inputs.gitRef }} to ${{ inputs.environment }} +run-name: Deploy ${{ inputs.gitRef || github.ref_name }} to ${{ inputs.environment || 'integration' }} on: workflow_dispatch: @@ -35,12 +35,12 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_GOVUK_ECR_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_GOVUK_ECR_SECRET_ACCESS_KEY }} trigger-deploy: - name: Trigger deploy to ${{ github.event.inputs.environment }} + name: Trigger deploy to ${{ github.event.inputs.environment || 'integration' }} needs: build-and-publish-image uses: alphagov/govuk-infrastructure/.github/workflows/deploy.yaml@main with: imageTag: ${{ needs.build-and-publish-image.outputs.imageTag }} - environment: ${{ github.event.inputs.environment }} + environment: ${{ github.event.inputs.environment || 'integration' }} secrets: WEBHOOK_TOKEN: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_TOKEN }} WEBHOOK_URL: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_URL }} From e17bbde702487a23d5e8e7243737e97a235c52a7 Mon Sep 17 00:00:00 2001 From: Sean Rankine Date: Tue, 1 Nov 2022 16:18:04 +0000 Subject: [PATCH 2/2] Use inputs instead of github.event.inputs context This switches the workflow to use the more concise way to access input variables. The inputs and github.event.inputs context are exactly the same, except booleans are preserved in the inputs context. --- .github/workflows/deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7c86a556b..ad8a9ee90 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -30,17 +30,17 @@ jobs: name: Build and publish image uses: alphagov/govuk-infrastructure/.github/workflows/build-and-push-image.yaml@main with: - gitRef: ${{ github.event.inputs.gitRef || github.ref }} + gitRef: ${{ inputs.gitRef || github.ref }} secrets: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_GOVUK_ECR_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_GOVUK_ECR_SECRET_ACCESS_KEY }} trigger-deploy: - name: Trigger deploy to ${{ github.event.inputs.environment || 'integration' }} + name: Trigger deploy to ${{ inputs.environment || 'integration' }} needs: build-and-publish-image uses: alphagov/govuk-infrastructure/.github/workflows/deploy.yaml@main with: imageTag: ${{ needs.build-and-publish-image.outputs.imageTag }} - environment: ${{ github.event.inputs.environment || 'integration' }} + environment: ${{ inputs.environment || 'integration' }} secrets: WEBHOOK_TOKEN: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_TOKEN }} WEBHOOK_URL: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_URL }}