Skip to content

Commit

Permalink
user docs github action: Don't fail the job if no xliff files were ch…
Browse files Browse the repository at this point in the history
…anged.
  • Loading branch information
michaelDCurran committed Aug 29, 2024
1 parent d190948 commit bb6d9c5
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,25 @@ jobs:
}
if: success()

- name: Commit changes
run: |
$ErrorActionPreference = 'Stop'
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
git add user_docs/en/*.xliff
git commit -m "Update user documentation files"
if: success()

- name: Push changes
- name: Commit and Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$ErrorActionPreference = 'Stop'
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git push origin HEAD
$filesChanged = git diff --name-only -- *.xliff
if($filesChanged) {
Write-Host "xliff files were changed. Committing and pushing changes."
foreach ($file in $filesChanged) {
git add $file
git commit -m "Update $file"
}
git push origin HEAD
} else {
Write-Host "No xliff files were changed. Skipping commit and push."
}
if: success()

- name: Crowdin upload
Expand All @@ -81,7 +84,7 @@ jobs:
# Check if we changed userGuide.xliff in this action.
# If we did, upload it to Crowdin.
$ErrorActionPreference = 'Stop'
$changed = git diff --name-only HEAD~1.. -- user_docs/en/userGuide.xliff
$changed = git diff --name-only ${{GITHUB.SHA}}.. -- user_docs/en/userGuide.xliff
if($changed) {
Write-Host "Uploading userGuide.xliff to Crowdin"
# 18 is the file ID for userGuide.xliff in Crowdin.
Expand Down

0 comments on commit bb6d9c5

Please sign in to comment.