Skip to content

updated Actions permissions #6

updated Actions permissions

updated Actions permissions #6

Workflow file for this run

name: Refresh Power BI documentation and localized files
on: [push]
jobs:
setup-and-process:
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Power BI Desktop
run: choco install --ignore-checksums powerbi
- name: Process cultures sequentially
run: |
$cultures = @('en-US', 'fr-FR')
$date = Get-Date -Format "yyyyMMdd"
$branchName = "update_$date"
$hasChanges = $false
foreach ($culture in $cultures) {
# Set culture-specific environment variable
$env:PQ_UICultureOverride = $culture
# Start Power BI Desktop in the appropriate culture
$pbixPath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "pre-scripts\dox.pbix"
Start-Process "C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe" -ArgumentList $pbixPath
Start-Sleep -Seconds 60
# Get the msmdsrv.exe port
$msmdsrvPorts = Get-Process -Name msmdsrv -ErrorAction SilentlyContinue | ForEach-Object {
Get-NetTCPConnection -OwningProcess $_.Id | Select-Object LocalPort -Unique
}
if ($msmdsrvPorts) {
# Process the database on the instance for the current culture
$port = $msmdsrvPorts[0].LocalPort
$outputJsonFile = "${culture}.json".Replace('-', '')
pwsh -File ./.github/scripts/generate-doc-output.ps1 -port $port -outputJsonFile $outputJsonFile
# Check for changes and commit if there are any
git diff --exit-code $outputJsonFile
if ($LASTEXITCODE -eq 1) {
git checkout -b $branchName
git add $outputJsonFile
git commit -m "Update localization files for $culture"
git push origin HEAD:$branchName
$hasChanges = $true
}
} else {
Write-Host "No msmdsrv.exe process found."
}
# Close Power BI Desktop
Stop-Process -Name PBIDesktop -Force -ErrorAction SilentlyContinue
Write-Host "Power BI Desktop closed for culture $culture."
}
# Create a Pull Request if there are changes
if ($hasChanges) {
gh pr create --title "Update localization files" --body "This PR includes updated localization files." --head $branchName --base main
}
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}