Skip to content

Commit

Permalink
Allow PullRequestHandler to use ubuntu-latest (microsoft#1030)
Browse files Browse the repository at this point in the history
Fixes microsoft#1008

Allow Update AL-Go System Files to update runs-on in
PullRequestHandler.yaml, except for PregateCheck.
PregateCheck is set to use runs-on: windows-latest which will not be
updated.
Update AL-Go System Files will update occurances of "runs-on: [
windows-latest ]" with "runs-on: [ (runs-on setting) ]"

Co-authored-by: freddydk <[email protected]>
  • Loading branch information
freddydk and freddydk committed Apr 15, 2024
1 parent f2f4529 commit c4cf36c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function GetWorkflowContentWithChangesFromSettings {
ModifyPullRequestHandlerWorkflow -yaml $yaml -repoSettings $repoSettings
}

if ($baseName -ne "UpdateGitHubGoSystemFiles" -and $baseName -ne "PullRequestHandler" -and $baseName -ne 'Troubleshooting') {
if ($baseName -ne "UpdateGitHubGoSystemFiles" -and $baseName -ne 'Troubleshooting') {
ModifyRunsOnAndShell -yaml $yaml -repoSettings $repoSettings
}

Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Note that when using the preview version of AL-Go for GitHub, we recommend you U
- Issue 997 'Deliver to AppSource' action fails for projects containing a space
- Issue 987 Resource not accessible by integration when creating release from specific version
- Issue 979 Publish to AppSource Documentation
- Issue 1008 Allow PullRequestHandler to use ubuntu or self hosted runners for all jobs except for pregateCheck

### New Settings
- `deliverToAppSource`: a JSON object containing the following properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
jobs:
PregateCheck:
if: (github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name) && (github.event_name != 'pull_request')
runs-on: [ windows-latest ]
runs-on: windows-latest
steps:
- uses: microsoft/AL-Go-Actions/VerifyPRChanges@main

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
jobs:
PregateCheck:
if: (github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name) && (github.event_name != 'pull_request')
runs-on: [ windows-latest ]
runs-on: windows-latest
steps:
- uses: microsoft/AL-Go-Actions/VerifyPRChanges@main

Expand Down
12 changes: 12 additions & 0 deletions Tests/WorkflowSanitation/WorkflowFileContent.Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ Describe "All AL-GO workflows should have similar content" {
}
}
}

Describe "PreGateCheck in PullRequestHandler should use runs-on: windows-latest" {
It 'Check PullRequestHandler.yaml for runs-on: windows-latest' {
# Check that PullRequestHandler.yaml in both templates uses runs-on: windows-latest, which doesn't get updated by the Update AL-Go System Files action
$ScriptRoot = $PSScriptRoot
. (Join-Path $ScriptRoot "../../Actions/CheckForUpdates/yamlclass.ps1")
foreach($template in @('Per Tenant Extension','AppSource App')) {
$yaml = [Yaml]::load((Join-Path $ScriptRoot "..\..\Templates\$template\.github\workflows\PullRequestHandler.yaml" -Resolve))
$yaml.Get('jobs:/PregateCheck:/runs-on').content | Should -Be 'runs-on: windows-latest' -Because "PreGateCheck in $template/PullRequestHandler.yaml should use runs-on: windows-latest"
}
}
}

0 comments on commit c4cf36c

Please sign in to comment.