Repository navigation
Support calling AL-Go workflows as reusable workflows (workflow_call) - #2397
Daniele Lixi (y0m0) wants to merge 23 commits into
Conversation
|
@microsoft-github-policy-service agree |
d4c3983 to
298acc8
Compare
298acc8 to
17931fc
Compare
Johannes Wikman (jwikman)
left a comment
There was a problem hiding this comment.
Great work Daniele Lixi (@y0m0)! 👍
Just a few comments for now, I'll have a new check when you've published the PR (you can request review from me then, if you want).
|
|
||
| Most AL-Go workflows can be called as [reusable workflows](https://docs.github.com/en/actions/sharing-automations/reusing-workflows) (`workflow_call`) from your own custom workflows. This allows you to orchestrate AL-Go workflows, for example to create a release, publish it and increment the version number in one run, with approval gates in between. The orchestration logic lives in your own workflow, AL-Go only exposes the building blocks. | ||
|
|
||
| The following workflows can be called: CI/CD, Create Release, Create Online Dev. Environment, Deploy Reference Documentation, Increment Version Number, Publish To AppSource (AppSource apps), Publish To Environment, Pull Power Platform changes and Push Power Platform changes (Per Tenant Extensions), Test Current, Test Next Minor, Test Next Major, Troubleshooting and Update AL-Go System Files. |
There was a problem hiding this comment.
Maybe these could be presented in a bullet list instead, it would improve readability.
| > In a called workflow, the GitHub context (`github.workflow`, `github.event_name`, `github.run_id`, `github.run_number` etc.) belongs to the calling workflow. AL-Go handles this for inputs, workflow specific settings and input validation, but be aware of the following: | ||
| > | ||
| > - Telemetry, the workflow name used by Run-AlPipeline and the `triggers` condition of [conditional settings](settings.md#conditional-settings) use the name and the event of the calling workflow. | ||
| > - Build numbers based on the run number (`appBuild`/`appRevision`) use the run number of the calling workflow. | ||
| > - The Finalize step of the called workflow includes the jobs of the calling workflow when determining the conclusion. | ||
| > - If you use `${{ github.workflow }}` in [workflowConcurrency](settings.md#workflowConcurrency) for a workflow you call, the concurrency group will be the name of the calling workflow. If the calling workflow uses the same concurrency group, the called workflow can never start (GitHub will cancel it). Use a fixed name in the concurrency group of workflows you call. | ||
| > - A called CI/CD workflow always builds all projects (incremental builds are not used). Runs of the calling workflow are not named CI/CD, so they are not used as a baseline for incremental builds, and not found when other workflows or repositories look for the latest successful CI/CD build (for example Publish To Environment with `latest`, or dependencies on this repository using `latestBuild`). Create Release with `buildVersion: latest` is not affected. | ||
| > - Jobs that download build artifacts from the current run (for example Deploy, Deliver and Deploy Reference Documentation in CI/CD) download the artifacts of the entire run of the calling workflow. Call at most one build workflow (CI/CD, Test Current, Test Next Minor or Test Next Major) per run of your workflow. | ||
|
|
There was a problem hiding this comment.
Great information!
| ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} | ||
| ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} |
There was a problem hiding this comment.
I believe these lines are not related to the workflow_call feature, but added to align with the other non-PP workflows?
Either document in PR description or remove (if an unintended change).
| ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} | ||
| ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} |
There was a problem hiding this comment.
I believe these lines are not related to the workflow_call feature, but added to align with the other non-PP workflows?
Either document in PR description or remove (if an unintended change).
| ### Allow pre-release packages as NuGet dependencies | ||
|
|
||
| AL-Go now supports including pre-release versions of Business Central app packages from NuGet feeds. To enable this, append `-allowPrerelease` to the `nuGetFeedSelectMode` setting in your project configuration. For example, `LatestMatching-allowPrerelease` will select the latest matching version of the package, including pre-release versions. | ||
| ### Call AL-Go workflows from your own workflows (`workflow_call`) |
There was a problem hiding this comment.
A new version of AL-Go (v10.1) has been released.
Please move your release notes changes to above the ## v10.1 section in the RELEASENOTES.md file.
This ensures your changes are included in the next release rather than being listed under an already-released version.
When a workflow is called via workflow_call, github.workflow and the event payload belong to the calling workflow. Add optional inputs workflowName and inputsJson so called workflows can validate their own inputs. - Validate releaseType for Create release, since choice inputs are not supported for workflow_call - Do not validate an empty updateVersionNumber in Create release (empty means no version update; toJson(inputs) always includes all inputs) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add optional inputs workflowEventName and inputsJson so workflows called via workflow_call dump their own inputs instead of the caller's event payload. Add unit tests for the action. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add an optional workflowEventName input (default github.event_name) used to decide whether to build all projects. When an AL-Go workflow is called as a reusable workflow, github.event_name is the event of the calling workflow, so the template passes env.WorkflowEventName instead. There is no incrementalBuilds.onWorkflow_Call setting, so workflow_call results in a full build. The pull request target branch logic still uses the real event. Add tests for Get-BuildAllProjectsBasedOnEventAndSettings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…en called When called as a reusable workflow, github.workflow is the name of the calling workflow. Add a WorkflowName env variable and pass it to ReadSettings, so workflow-specific settings are still read for Update AL-Go System Files. Also pass WorkflowEventName and the inputs to DumpWorkflowInfo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
For every template workflow declaring workflow_call, verify that: - a required caller string input exists - workflow_dispatch inputs are mirrored (choice/untyped become string) - WorkflowEventName and WorkflowName env variables are defined, and WorkflowName matches the workflow name - github.event.inputs, github.event_name and github.workflow are not used outside these definitions - ReadSettings, ValidateWorkflowInput, DumpWorkflowInfo, DetermineProjectsToBuild and GetWorkflowMultiRunBranches steps receive the reusable workflow overrides Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs and pass the workflow name, event name and inputs to ReadSettings, ValidateWorkflowInput and DumpWorkflowInfo, as the github context belongs to the caller when the workflow is called. Input validation also runs when called. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch (releaseType becomes a string input, validated by ValidateWorkflowInput). Expose releaseId, releaseVersion and commitish as workflow outputs. Use inputs instead of github.event.inputs (createReleaseBranch is now evaluated as a boolean) and pass the workflow name, event name and inputs to ReadSettings, ValidateWorkflowInput, DumpWorkflowInfo and DetermineProjectsToBuild. When called, the concurrency group uses the name of this workflow instead of the name of the calling workflow, which would otherwise deadlock with a caller using the same concurrency group. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs and pass the workflow name, event name and inputs to ReadSettings and DumpWorkflowInfo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs and pass the workflow name, event name and inputs to ReadSettings and DumpWorkflowInfo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…low_call) Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs and pass the workflow name, event name and inputs to ReadSettings and DumpWorkflowInfo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and pass the workflow name to ReadSettings, as github.workflow is the name of the calling workflow when called. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs and pass the workflow name to ReadSettings. Also add the top-level env section with ALGoOrgSettings and ALGoRepoSettings, which other AL-Go workflows already have, so organization and repository settings variables are applied here too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a workflow_call trigger with a required caller input and the same inputs as workflow_dispatch. Use inputs instead of github.event.inputs and pass the workflow name to ReadSettings. Also add the top-level env section with ALGoOrgSettings and ALGoRepoSettings, which other AL-Go workflows already have, so organization and repository settings variables are applied here too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The comment was accidentally removed when adding the reusable workflow tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…low_call) Add a workflow_call trigger with a required caller input to Current, NextMinor and NextMajor, and pass the workflow name, event name and inputs to ReadSettings, DumpWorkflowInfo and DetermineProjectsToBuild. _BuildALGoProject gets an optional workflowName input used by ReadSettings (default github.workflow), so workflow-specific settings (e.g. "Test Next Major.settings.json") are still applied to the build when the workflow is called. The env context isn't available in the with: section of a job calling a reusable workflow, so the workflow name expression is repeated there. The sanitation test now verifies that every workflow name literal matches the name of the workflow and that jobs calling _BuildALGoProject pass workflowName. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow the AL-Go convention of converting JSON to hashtables after ConvertFrom-Json. ValidateWorkflowInput keeps the PSCustomObject format, as the Validate-<workflow>.ps1 scripts expect the inputs in the same format as the event payload (documented with a comment). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Add workflow_call trigger with the required caller input - WorkflowEventName/WorkflowName env, passed to DumpWorkflowInfo, ReadSettings and DetermineProjectsToBuild (a called CI/CD always builds all projects) - Pass workflowName to the _BuildALGoProject jobs (preserved by CheckForUpdates when duplicating build jobs for workflowDepth > 1) - _BuildPowerPlatformSolution: optional workflowName input for reading workflow specific settings, passed from CI/CD - Sanitation test: jobs calling _BuildPowerPlatformSolution pass workflowName Co-Authored-By: Claude Opus 5.5 <[email protected]>
- CustomizingALGoForGitHub.md: new section with the list of callable workflows, the caller contract (caller input, secrets: inherit, permissions), an orchestrator example (Create Release -> Publish To AppSource -> approval -> Increment Version Number) and known limitations - settings.md: notes on workflow-specific settings, the triggers condition and workflowConcurrency when a workflow is called - RELEASENOTES.md: new section Co-Authored-By: Claude Opus 5.5 <[email protected]>
The default value of a required workflow_call input is never used (flagged by actionlint). The sanitation test now checks that required workflow_call inputs have no default value. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
17931fc to
d72ba1a
Compare
Summary
Implements discussion #2187: most AL-Go workflows can now be called as reusable workflows (
workflow_call), so repos can orchestrate AL-Go from their own workflows (e.g. Create Release → Publish To AppSource → approval gate → Increment Version Number) instead of usinggh workflow runand polling.Follows the pattern established by #2031 / #2154 for Update AL-Go System Files: a required
callerinput,inputs.*instead ofgithub.event.inputs.*, andenv.WorkflowEventName/env.WorkflowNameinstead ofgithub.event_name/github.workflow(the called workflow otherwise only sees the caller'sgithubcontext).Scope
Callable: CI/CD, Create Release, Create Online Dev. Environment, Deploy Reference Documentation, Increment Version Number, Publish To AppSource, Publish To Environment, Pull/Push Power Platform changes, Test Current/Next Minor/Next Major, Troubleshooting (Update AL-Go System Files already supported it).
Not callable (by design): Pull Request Handler (depends on the PR/merge_group event payload), and the one-time scaffolding workflows Create App, Create Test App, Create Performance Test App, Add existing app or test app.
What changed
ValidateWorkflowInput,DumpWorkflowInfo,DetermineProjectsToBuild: new optional inputs (workflowName,inputsJson,workflowEventName) so these actions work correctly when called with a caller's event context instead of their own. A called CI/CD always does a full build (there's noincrementalBuilds.onWorkflow_callsetting).Create Releasenow validatesreleaseTypeitself (thechoicetype constraint doesn't exist forworkflow_callinputs), exposesreleaseId/releaseVersion/commitishas outputs, and no longer deadlocks its concurrency group against a caller usinggithub.workflow.workflow_dispatchinputs inworkflow_call(with a requiredcallerstring input), passesworkflowName/workflowEventNameto the actions above, and replacesgithub.event.inputs/github.event_name/github.workflowusage with the caller-safe equivalents.Tests/WorkflowSanitation/WorkflowCall.Test.ps1) enforces this contract for every template workflow that declaresworkflow_call, in both the PTE and AppSource templates.RELEASENOTES.md,Scenarios/CustomizingALGoForGitHub.md(new section with an orchestrator example),Scenarios/settings.mdnotes, and the affected action READMEs.Known limitations (documented, not fixed)
When a workflow is called, the following still reflect the caller's values, since they come from the shared
githubcontext: telemetryWorkflowName,GITHUB_RUN_NUMBER-based app build numbers,RunPipelinepipeline name, and conditional-settingstriggers:matching. A called CI/CD's Deploy/Deliver/DeployALDoc jobs download all artifacts of the current (the orchestrator's) run, so an orchestrator should call at most one build workflow per run. Runs where CI/CD was called are named after the orchestrator, so they aren't picked up as an incremental-build baseline by later CI/CD runs.There's also an open GitHub bug (actions/runner#2274) where a
workflow_dispatch-triggered caller's inputs leak into the called workflow'sinputscontext. Known impact is cosmetic (DumpWorkflowInfooutput, harmless extra keys seen byValidateWorkflowInput); whether a leaked value can override a declared default when the caller doesn't pass that input is still being verified and will be documented as a follow-up if needed.Testing
Tests,Tests/WorkflowSanitation) green on PowerShell 7 and Windows PowerShell 5.workflow_call, exercising both push-triggered and manually-dispatched runs, verifying outputs, full builds, and artifact lookup across the two called jobs of the same run.directCommit, Publish To Environment, Test Next Major, a dispatch-only regression check) and the input-leak-precedence check above. Opening as a draft in the meantime for early feedback.Johannes Wikman (@jwikman) since you co-authored the discussion — happy to get your eyes on this whenever convenient, no rush given it's still a draft.