-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run "Update AL-Go System Files" on multiple branches #1037
base: main
Are you sure you want to change the base?
Conversation
Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml
Outdated
Show resolved
Hide resolved
…-al-go-multiple-branches
…-al-go-multiple-branches
Actions/GetWorkflowMultiRunBranches/GetWorkflowMultiRunBranches.ps1
Outdated
Show resolved
Hide resolved
Update doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a partial review, with some suggestions to think about
|
||
When run on a schedule, _Update AL-Go System Files_ only runs on the _main_ branch. By setting `includeBranches` in `workflowSchedule` setting, you can now run the workflow on a schedule on multiple branches. Read more at https://aka.ms/algosecrets#workflowSchedule. | ||
|
||
Dispatching the workflow manually still runs the workflow only on the branch it was dispatched on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The includeBranches is also available when running manually right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input takes priority when dispatching the workflow.
So, there's includeBranches
input: used when running manually.
workflowSchedule.includeBranches
setting: used when running on a schedule.
I had an iteration where the input was something like "run the same way as scheduled", but I quickly realized how it can be confusing. Especially when there's also commitOptions
setting.
Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml
Show resolved
Hide resolved
…-al-go-multiple-branches
…azhelez/AL-Go into update-al-go-multiple-branches
@@ -705,6 +705,10 @@ function ReadSettings { | |||
"messageSuffix" = "" | |||
"pullRequestAutoMerge" = $false | |||
"pullRequestLabels" = @() | |||
"createPullRequest" = $true | |||
} | |||
"workflowSchedule" = [ordered] @{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't need to add it in default settings.
switch ($env:GITHUB_EVENT_NAME) { | ||
'schedule' { | ||
Write-Host "Event is schedule: getting branches from settings" | ||
$branchPatterns = @($($(ConvertFrom-Json $env:settings).workflowSchedule.includeBranches)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add defensive check in case workflowSchedule
or includeBranches
is not defined.
@@ -63,7 +63,7 @@ $settings.Keys | ForEach-Object { | |||
} | |||
$outSettings += @{ "$setting" = $settingValue } | |||
if ($getSettings -contains $setting) { | |||
if ($settingValue -is [System.Collections.Specialized.OrderedDictionary] -or $settingValue -is [hashtable]) { | |||
if ($settingValue -is [System.Collections.Specialized.OrderedDictionary] -or $settingValue -is [hashtable] -or $settingValue -is [array]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
Issue: When scheduling "Update AL-Go System Files" workflow, it runs only on the default branch (GitHub Actions limitation).
This PR alters the workflow to be able to schedule "Update AL-Go System Files" to run on multiple branches.
Manually dispatching the workflow isn't changed.
New property
workflowSchedule
setting,includeBranches
, is added to specify the branches when running the workflow on a schedule.