Automate creating of settings.json to control logging verbosity #8
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
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
validate: | |
name: Validate WinGet Configurations | |
runs-on: windows-latest | |
steps: | |
- name: Install winget | |
uses: Cyberboss/install-winget@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Winget Info | |
run: winget --info | |
- name: Create settings file | |
run: | | |
$settingsPath = $(winget --info | Select-String -Pattern "%LOCALAPPDATA%\\Packages\\Microsoft.DesktopAppInstaller_[\w]*\\LocalState\\s" | ForEach-Object { $_.Matches.Value -replace '\\s', '\settings.json' }) | |
$expandedSettingsPath = [System.Environment]::ExpandEnvironmentVariables($settingsPath) | |
$settingsContent = Get-Content "./settings.json" | |
echo "Local settings content: $settingsContent" | |
echo "Writing local settings to winget settings: $expandedSettingsPath" | |
$settingsContent | Set-Content $expandedSettingsPath | |
- name: Validate settings | |
run: winget configuration validate -f .\configurations\settings.dsc.yaml | |
- name: Validate install | |
run: winget configuration validate -f .\configurations\install.dsc.yaml |