fix: push trigger in generated publish workflow never ran any jobs#76
fix: push trigger in generated publish workflow never ran any jobs#76EMaher wants to merge 5 commits into
Conversation
…flow The publish-workflow.ts template's push trigger was configured but all publish jobs were gated on `github.event.inputs.ENVIRONMENT`, which is undefined on push events, so no publish job ever ran on push. Fix: enable the first environment's job to also run on push to main, so that merges to main automatically trigger an incremental publish using GITHUB_SHA as the commit-id. Subsequent environments remain opt-in via workflow_dispatch (safe default for production gating). - First environment job condition: `ENVIRONMENT == 'dev' || event_name == 'push'` - Subsequent environments: gated on ENVIRONMENT input only, with comment showing how to chain sequential push-triggered deployment - The incremental step's `--commit-id` is already wired correctly via `needs.get-commit.outputs.commit_id` (from GITHUB_SHA); on push, COMMIT_ID_CHOICE is empty so `!= 'publish-all-artifacts-in-repo'` is true, automatically selecting incremental mode Added 3 new tests covering: - First env runs on push (event_name condition present) - Subsequent envs do NOT auto-run on push - commit-id is passed via incremental step condition Closes #46 Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/fc5694e2-a9e3-4a49-948a-9c1bfad737f1 Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/fc5694e2-a9e3-4a49-948a-9c1bfad737f1 Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
|
@copilot Have the Squad fan out and verify the code changes make the default behavoir for Specifically, I think the 'require human approval' part is missing. |
…ates
GitHub Actions:
- All environments now run in sequence on push to main (chained with needs)
- Subsequent env jobs have needs: [get-commit, publish-{prevEnv}] for sequential promotion
- Non-first environments include a comment directing users to configure
Required Reviewers in GitHub Settings > Environments > {env}
- This enables the "Review deployments" approval button flow on push
Azure DevOps:
- Fix dependsOn placement: moved inside stage definition (was incorrectly
placed before the `- stage:` entry in the YAML list)
- Non-first stages now include a comment directing users to configure
approval checks in Pipelines > Environments > {env}
Tests updated to reflect all environments running on push and
the new approval guidance comments.
Closes #46
Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/af96f6ab-4bfa-485c-8b3e-a19edca3cb60
Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/af96f6ab-4bfa-485c-8b3e-a19edca3cb60 Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
Done in commit GitHub Actions (
Azure DevOps (
Both templates now match the documented behavior: push to main → auto-deploys to first env (incremental, using Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
The
apiops initGitHub Actions publish workflow had apushtrigger, but everypublish-*job was gated ongithub.event.inputs.ENVIRONMENT, which is undefined on push events. The trigger fired but all jobs were skipped — a silent no-op.Changes
src/templates/github-actions/publish-workflow.ts|| github.event_name == 'push', so merges tomainautomatically trigger an incremental publishCOMMIT_ID_CHOICEis undefined →!= 'publish-all-artifacts-in-repo'is true →--commit-id ${{ needs.get-commit.outputs.commit_id }}is passed automaticallyworkflow_dispatch(safe default for production)tests/unit/templates/github-actions/publish-workflow.test.ts--commit-idfor push caseBefore (first env job, all envs identical):
After: