Skip to content

Only deploy the anyway apps from main (stop deploys from any branch push) - #27

Merged
atalyaalon merged 1 commit into
mainfrom
claude/laughing-galileo-165xk1-deploy-main-only
Nov 30, 2026
Merged

atalyaalon merged 1 commit into
mainfrom
claude/laughing-galileo-165xk1-deploy-main-only

Conversation

@atalyaalon

@atalyaalon atalyaalon commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

🚨 Please merge soon: today, any branch push can deploy to production

  • anyway.yml and anyway-dfc2.yml deploy to the dfc / dfc2 servers on a push to any branch that touches apps/anyway/** or apps-dfc2/anyway/**. The trigger has only a paths filter, no branches filter.
  • That's how #24's monthly backup schedule went live on 2026-11-28, before review (details). It also happened in July with a branch called create-dfc2-backup.

ℹ️ Merging this redeploys main to both servers, which restores daily backups

  • This PR changes the two workflow files, which are in their own trigger paths. So the merge runs anyway CI and dfc2 anyway CI on main.
  • main still has the daily backup schedule, so both servers go back to daily until Reduce DB backup costs: monthly dumps + expire dumps older than 1 year #24 is merged (why).
  • That's expected and harmless: only the cron entry changes, no containers restart and no images change.
  • The image-update automations' next pushes to main would do the same anyway.

Change

Adds branches: [main] to the push trigger of both workflows:

on:
  push:
    # only deploy from main: a push to any other branch must never deploy to the servers
    branches:
      - main
    paths:
      - ...
  workflow_dispatch:
  • Pushes to main: behave exactly as today, so merges still auto-deploy.
  • Manual runs (workflow_dispatch) are unchanged.
  • Pushes to other branches no longer deploy.

Automations that push to dfc-iac: not affected

These all push to main, which keeps deploying as before:

  • anyway (deploy.yml, committer "Anyway CI"): updates apps/anyway/.env and apps-dfc2/anyway/.env
  • anyway-etl (committer "Anyway ETL CI"): updates the ETL image tags
  • safety-data-client (deploy_app.yml): updates SAFETY_DATA_CLIENT_IMAGE
  • anyway-reports (main.yml)

Each clones dfc-iac and runs git push origin main with the DFC_IAC_DEPLOY_KEY deploy key. Pushes made with a deploy key trigger workflows, the same as today.

Why a separate PR

The same commit is already in #24. But GitHub uses the workflow file from the pushed commit, so it only protects branches that contain the fix. Every other branch made from main can still deploy on push until this is on main. This PR only needs a quick review, so it doesn't have to wait for #24. When #24 merges later, the change is identical, so there's no conflict.

Testing

Optional, stronger protection

  • Settings → Environments → New environment production → Deployment branches and tags → Selected branches: main.
  • Optionally add Required reviewers there. That would also gate the automations' deploys, so only do it if someone will approve them.
  • Then add environment: production to the anyway job in both workflows.

This also blocks a manual run on another branch, and can require an approval before each deploy.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XtN7GhfRRihvBTHsWxGZoV

The anyway and dfc2 anyway workflows deployed to the production servers
on a push to any branch that touched the app folders, so pushing a PR
branch deployed it before review. Restrict the push trigger to main;
manual runs (workflow_dispatch) are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtN7GhfRRihvBTHsWxGZoV

Copy link
Copy Markdown
Contributor Author

@tkalir @ziv17 heads-up, follow-up to this PR (deploys only from main): main in dfc-iac is now protected by a ruleset ("main rules"):

  • Changes to main go through a pull request. Direct pushes to main are rejected. No approval is required, so you can open a PR and merge it yourself.
  • Force pushes and deleting main are blocked.
  • Automatic deploys are unchanged. The CI pushes from anyway, safety-data-client, anyway-etl and anyway-reports use the dfc-iac deploy key, which is on the bypass list, so they keep pushing image updates straight to main.

Also changed in the repo settings:

  • Workflow token is read-only by default. Workflows that need more ask for it in their own permissions: block, as the monitoring workflows already do.
  • Secret scanning with push protection is on. A push containing what looks like a secret is blocked; you can still override it with a reason if it's a false positive.

If anything that used to work now gets rejected, please say so here.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants