fix: Double publish after alert activities #1464
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: on-pr-into-main | |
| permissions: | |
| contents: read | |
| env: | |
| PYTHON_VERSION: 3.12 | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - ready_for_review | |
| branches: | |
| - main | |
| jobs: | |
| run-pr-checks: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| - name: Set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Use specified utils version in PR | |
| env: | |
| PR_DESCRIPTION: ${{ github.event.pull_request.body }} | |
| # Match `utils:blah` and capture the blah | |
| run: | | |
| PR_UTILS_BRANCH=$(echo "$PR_DESCRIPTION" | grep -oP '`utils:\K[^`]+' || true) | |
| if [[ -n $PR_UTILS_BRANCH ]]; then | |
| echo "Going to use branch $PR_UTILS_BRANCH for utils" | |
| sed -i "s|emergency-alerts-utils\.git|emergency-alerts-utils.git@$PR_UTILS_BRANCH|" requirements.txt | |
| cat requirements.txt | |
| else | |
| echo "Leaving utils target as default" | |
| fi | |
| - name: Verify Docker | |
| run: | | |
| docker --version || echo 'Could not find docker engine' | |
| docker compose version || echo 'Could not find docker compose' | |
| - name: Install and upgrade pre-requisites | |
| run: | | |
| python3.12 -m pip install --upgrade pip wheel setuptools | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev | |
| sudo apt-get install -y libssl-dev | |
| - name: Launch a postgres instance | |
| run: | | |
| export POSTGRES_PASSWORD=root | |
| export POSTGRES_USER=postgres | |
| export POSTGRES_DB=postgres | |
| docker compose -f docker-compose-tests.yml up --detach pg | |
| - name: Bootstrap Python app and run tests | |
| run: | | |
| export ENVIRONMENT='local' | |
| export DANGEROUS_SALT='dev-notify-salt' | |
| export SECRET_KEY='dev-notify-secret-key' | |
| export ENCRYPTION_DANGEROUS_SALT='dev-notify-salt' | |
| export ENCRYPTION_SECRET_KEY='dev-notify-secret-key' | |
| export ADMIN_CLIENT_SECRET='dev-notify-secret-key' | |
| export GOVUK_CLIENT_SECRET='dev-govuk-secret' | |
| export GOVUK_ALERTS_PUBLISH_CLIENT_SECRET='dev-govuk-publish-secret' | |
| export FLASK_APP=application.py | |
| export TEST_RDS_HOST=localhost | |
| export TEST_RDS_USER=postgres | |
| export TEST_RDS_PASSWORD=root | |
| export TEST_RDS_PORT=5432 | |
| set -eu | |
| make bootstrap-for-tests | |
| make test | |
| functional-tests: | |
| name: Invoke Functional Tests | |
| uses: alphagov/emergency-alerts-functional-tests/.github/workflows/run-functional-tests-pr.yml@main | |
| with: | |
| env-default: REPO_BRANCH_API=${{ github.head_ref }} | |
| pr-description: ${{ github.event.pull_request.body }} | |
| secrets: | |
| EAS_GITHUB_RUNNER_RO_TOKEN: ${{ secrets.EAS_GITHUB_RUNNER_RO_TOKEN }} |