From b1486cb29476b084c2de2d647bc46b887b48a80e Mon Sep 17 00:00:00 2001 From: nimalank7 Date: Fri, 19 Jul 2024 13:09:07 +0100 Subject: [PATCH] Remove set-automatic-deploys GitHub action Description: - At current the `set-automatic-deploys-enabled` is broken as there is no corresponding event binding so when a POST request is made from the `set-automatic-deploy` GitHub action` nothing happens - Discussed with @theseanything that maintaining this workflow is too cumbersome since we infrequently disable automatic deploys. So a decision has been made to remove the workflow and instead ask developers to update `govuk-helm-charts/image-tags` manually --- .github/workflows/set-automatic-deploys.yml | 63 --------------------- 1 file changed, 63 deletions(-) delete mode 100644 .github/workflows/set-automatic-deploys.yml diff --git a/.github/workflows/set-automatic-deploys.yml b/.github/workflows/set-automatic-deploys.yml deleted file mode 100644 index 90fbfae34..000000000 --- a/.github/workflows/set-automatic-deploys.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Set automatic deploys - -on: - workflow_call: - inputs: - automaticDeploysEnabled: - description: 'Configures whether automatic deployments are enabled' - required: true - type: boolean - appName: - required: false - default: ${{ github.event.repository.name }} - type: string - environment: - description: 'Environment to modify' - required: false - default: 'integration' - type: string - secrets: - WEBHOOK_TOKEN: - required: true - WEBHOOK_URL: - required: true - GH_TOKEN: - required: true - -jobs: - set-automatic-deploys: - name: Set automatic deploys - runs-on: ubuntu-latest - steps: - - name: Check deploy permissions - id: deploy-permissions - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - GITHUB_TEAM: gov-uk-production-deploy - GITHUB_USER: ${{ github.triggering_actor }} - run: | - TEAM_MEMBERSHIP=$(gh api "orgs/alphagov/teams/${GITHUB_TEAM}/memberships/${GITHUB_USER}" -q .state || echo false) - - if ! [[ "${TEAM_MEMBERSHIP}" = active || "${ENVIRONMENT}" = integration ]]; then - echo "::error title=Insufficient permissions to deploy::User ${GITHUB_USER} needs to be a member of the ${GITHUB_TEAM} team" - exit 1 - fi - - - name: Send webhook - if: steps.deploy-permissions.outcome == 'success' - env: - AUTOMATIC_DEPLOYS_ENABLED: ${{ inputs.automaticDeploysEnabled }} - ENVIRONMENT: ${{ inputs.environment }} - REPO_NAME: ${{ inputs.appName }} - WEBHOOK_TOKEN: ${{ secrets.WEBHOOK_TOKEN }} - WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} - run: | - curl --fail-with-body --silent \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${WEBHOOK_TOKEN}" \ - -d "{ - \"environment\": \"${ENVIRONMENT}\", - \"repoName\": \"${REPO_NAME}\", - \"automaticDeploysEnabled\": \"${AUTOMATIC_DEPLOYS_ENABLED}\" - }" \ - "${WEBHOOK_URL}/set-automatic-deploys-enabled"