Skip to content

Rework inputs handling of update workflow for trigger 'workflow_call'#2154

Merged
aholstrup1 merged 10 commits intomicrosoft:mainfrom
OleWunschmann:fix-reusable-update-workflow
Mar 23, 2026
Merged

Rework inputs handling of update workflow for trigger 'workflow_call'#2154
aholstrup1 merged 10 commits intomicrosoft:mainfrom
OleWunschmann:fix-reusable-update-workflow

Conversation

@OleWunschmann
Copy link
Copy Markdown
Contributor

@OleWunschmann OleWunschmann commented Mar 4, 2026

❔What, Why & How

What

The workflow_call inputs in the update workflow are handled incorrectly.
They must be accessed as inputs.*, not github.event.inputs.*.
Also, github.event_name will always reflect the trigger of the calling workflow, not the reusable workflow itself.

In my tests of the original contribution that added the trigger to the update workflow, my use case tests passed by coincidence because the parent workflow had an input named directCommit itself and all other inputs used their default values.

Why

When the update workflow is invoked as a reusable workflow, it should use the values defined in its own inputs.
These should be treated the same as when the workflow is triggered by workflow_dispatch (for example, when determining branches).

How

  • Modified the action GetWorkflowMultiRunBranches:
    • Added a new optional input workflowEventName
      • Default: github.event_name
      • Purpose: override the event name used to determine which branches to include
      • Event workflow_call resuls in the same output as event workflow_dispatch
  • Modified the update workflow:
    • Replaced all uses of github.event.inputs.* with inputs.*
    • Added a new required workflow_call input caller (string):
      • Marks that the update workflow was called from another workflow
    • Added a new environment variable WorkflowEventName:
      • Set to github.ref_name or to workflow_call when the caller input is present
      • Passed to input workflowEventName of action GetWorkflowMultiRunBranches
      • Used to determine the commit options

Related to original discussion #1855 and PR #2031

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md

@OleWunschmann OleWunschmann marked this pull request as ready for review March 4, 2026 21:55
@OleWunschmann OleWunschmann requested a review from a team as a code owner March 4, 2026 21:55
Copilot AI review requested due to automatic review settings March 4, 2026 21:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes how the “Update AL-Go System Files” reusable workflow reads inputs when invoked via workflow_call, and adds an override mechanism in GetWorkflowMultiRunBranches so branch selection behaves the same for workflow_call as for workflow_dispatch.

Changes:

  • Add workflowEventName input to GetWorkflowMultiRunBranches and treat workflow_call like workflow_dispatch.
  • Rework UpdateGitHubGoSystemFiles reusable workflow templates to use inputs.* and introduce a required __caller marker input to detect workflow_call usage.
  • Extend Pester coverage for workflow_call and parameter override behavior; update release notes.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Actions/GetWorkflowMultiRunBranches/GetWorkflowMultiRunBranches.ps1 Switches event handling to use a parameter override and adds workflow_call handling.
Actions/GetWorkflowMultiRunBranches/action.yaml Exposes new workflowEventName input and passes it through to the script.
Actions/GetWorkflowMultiRunBranches/README.md Documents the new input.
Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml Updates reusable workflow input handling and passes overridden event name into branch selection.
Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml Same workflow_call input handling changes as the AppSource template.
Tests/GetWorkflowMultiRunBranches.Test.ps1 Adds workflow_call scenarios and verifies workflowEventName override behavior.
RELEASENOTES.md Notes the workflow_call input-handling rework.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mazhelez mazhelez self-requested a review March 17, 2026 13:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OleWunschmann
Copy link
Copy Markdown
Contributor Author

OleWunschmann commented Mar 18, 2026

@aholstrup1
I added a fix for the failing workflow "PSScriptAnalyzer".
The problem seems to be the usage of "—". I replaced them with "-".

@aholstrup1 aholstrup1 merged commit 4433eef into microsoft:main Mar 23, 2026
6 checks passed
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.

4 participants