Skip to content

Commit

Permalink
more magic with PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugoberry committed Nov 3, 2023
1 parent 86b812f commit 3ecc355
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:

- name: Process cultures sequentially
run: |
$cultures = @('en-US', 'fr-FR') # Add or remove cultures as needed
$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
Expand All @@ -32,6 +36,17 @@ jobs:
$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."
}
Expand All @@ -41,4 +56,12 @@ jobs:
Write-Host "Power BI Desktop closed for culture $culture."
}
# Create a Pull Request if there are changes
if ($hasChanges) {
# Assuming you're using GitHub CLI to create PR
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 }}

0 comments on commit 3ecc355

Please sign in to comment.