-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New pipeline to check for invalid file paths in templates.json
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Check Paths | ||
|
||
on: | ||
push: | ||
paths: | ||
- "sonarr/**.ya?ml" | ||
- "sonarr/**.ya?ml" | ||
- .github/workflows/check-paths.yml | ||
- templates.json | ||
pull_request: | ||
paths: | ||
- "sonarr/**.ya?ml" | ||
- "sonarr/**.ya?ml" | ||
- .github/workflows/check-paths.yml | ||
- templates.json | ||
|
||
jobs: | ||
checkpaths: | ||
name: Check Paths | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check templates.json | ||
run: pwsh ci/CheckInvalidTemplatePaths.ps1 templates.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[string] $JsonPath | ||
) | ||
|
||
function GetPaths($serviceType) { | ||
Get-Content -Path $JsonPath | ||
| ConvertFrom-Json | ||
| ForEach-Object { $_.$serviceType.template } | ||
} | ||
|
||
$nonExistentFiles = $(GetPaths("radarr"); GetPaths("sonarr")) | ||
| Where-Object {!(Test-Path -Path $_ -PathType Leaf)} | ||
|
||
|
||
if ($nonExistentFiles.length -gt 0) { | ||
"FAILED: More than one invalid file path found:" | ||
Write-Host ($nonExistentFiles -join "`n") | ||
exit 1 | ||
} | ||
|
||
"No invalid file paths found" | ||
exit 0 |