From 3ecc3558fd146504f13060056879c73c1eb1f3d9 Mon Sep 17 00:00:00 2001 From: Igor Cotruta Date: Fri, 3 Nov 2023 17:36:12 +0000 Subject: [PATCH] more magic with PR --- .github/workflows/doc.yaml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/doc.yaml b/.github/workflows/doc.yaml index a05804327..e130314e7 100644 --- a/.github/workflows/doc.yaml +++ b/.github/workflows/doc.yaml @@ -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 @@ -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." } @@ -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 }}