Skip to content

Automate creating of settings.json to control logging verbosity #8

Automate creating of settings.json to control logging verbosity

Automate creating of settings.json to control logging verbosity #8

Workflow file for this run

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