-
Notifications
You must be signed in to change notification settings - Fork 180
Description
Description
When using the PublishToEnvironment workflow to deploy a PR from the main branch (using appVersion: PR_<PR_ID>), the deployment is registered against the workflow's trigger ref (main) instead of the actual PR branch being deployed.
This causes GitHub's PR interface to show "This branch has not been deployed" even though the PR has been successfully deployed.
Current Behavior
- Run PublishToEnvironment workflow from
mainbranch - Set
appVersion: PR_123to deploy a specific PR - Workflow successfully deploys the PR code
- GitHub creates deployment record against
mainbranch (workflow trigger) - PR AL-Go for on-prem BC? #123 shows "This branch has not been deployed" ❌
Expected Behavior
When appVersion matches pattern PR_<ID>:
- Workflow should detect this is a PR deployment
- Fetch the PR branch name via GitHub API
- Create deployment record against the PR branch (not workflow trigger ref)
- PR shows correct deployment status ✅
Why This Matters
Common use case: Running deployments from main with environment protection rules, while deploying feature branch code. This pattern allows:
- Centralized deployment control from main branch
- Environment protection rules enforcement
- PR-based artifact deployment
- Clear deployment visibility in PR interface
Without proper deployment tracking, teams lose visibility into which PRs have been deployed to which environments.
Proposed Solution
Modify PublishToEnvironment.yaml Deploy job to:
- Add
deployments: writepermission - Before deployment, detect if
appVersionmatchesPR_<ID>pattern - If yes, fetch PR branch ref via GitHub API
- Create explicit deployment record against PR branch using GitHub Deployments API
- Update deployment status after deployment completes
This preserves all existing functionality while correctly tracking PR deployments.
Workaround
Users can manually add deployment tracking logic to their workflows (see solution above), but this should be built into AL-Go's template.
Environment
- AL-Go Version: v8.1 (issue also present in v8.2)
- Template: Per Tenant Extension (PTE)
- Workflow:
PublishToEnvironment.yaml
Related
GitHub's environment: key automatically creates deployments against the workflow trigger ref, which is the root cause of this issue. Explicit API calls are needed to override this behavior for PR deployments.