agama/.github/workflows/weblate-update-pot.yml
Workflow config file is invalid. Please check your config file: Line: 14 Column 5: Failed to match job-factory: Line: 14 Column 9: Failed to parse: unexpected end of input while parsing variable access, function call, null, bool, int, float or string. expecting "IDENT", "(", "INTEGER", "FLOAT", "STRING" Line: 14 Column 5: Failed to match workflow-job: Line: 14 Column 9: Failed to parse: unexpected end of input while parsing variable access, function call, null, bool, int, float or string. expecting "IDENT", "(", "INTEGER", "FLOAT", "STRING" Line: 21 Column 5: Unknown Property steps Forgejo Actions YAML Schema validation error
Ladislav Slezák 8c2780d62c
Update links to the agama-weblate repository (#1651)
## Problem

- The `agama-weblate` repository has been also moved

## Solution

- Update the references in the GitHub Actions to use generic
`github.repository_owner` (the actions use
`!github.event.repository.fork` condition so they should never run
outside of the `project-agama` , but this is more flexible)
- Update the links in the documentation

## Notes

- I was thinking about using relative URLs in the documentation, but
then it would not work in forks (unless you fork the `agama-weblate`
repository as well). Absolute URLs are probably better here, I do not
expect we move the location anytime soon. 😃
2024-09-30 16:42:14 +02:00

196 lines
6.8 KiB
YAML

name: Weblate Update POT
on:
schedule:
# run every working day (Monday-Friday) at 1:42AM UTC
- cron: "42 1 * * 0-4"
# allow running manually
workflow_dispatch:
jobs:
update-pot:
# do not run in forks
if: !github.event.repository.fork
runs-on: ubuntu-latest
container:
image: registry.opensuse.org/opensuse/tumbleweed:latest
steps:
- name: Configure and refresh repositories
# disable unused repositories to have a faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref
- name: Install Default Ruby
run: zypper --non-interactive install --no-recommends ruby
- name: Install tools
run: |
RUBY_VERSION=$(ruby -e "puts RbConfig::CONFIG['ruby_version']")
zypper --non-interactive install --no-recommends diffutils git gettext-tools npm-default "rubygem(ruby:$RUBY_VERSION:yast-rake)" "rubygem(ruby:$RUBY_VERSION:gettext)" yast2-devtools which
- name: Checkout Agama sources
uses: actions/checkout@v4
with:
path: agama
- name: Generate web POT file
run: |
cd agama/web
./build_pot
msgfmt --statistics agama.pot
- name: Validate the generated web POT file
run: msgfmt --check-format agama/web/agama.pot
- name: Checkout Weblate sources
uses: actions/checkout@v4
with:
path: agama-weblate
repository: ${{ github.repository_owner }}/agama-weblate
token: ${{ secrets.GH_TOKEN }}
- name: Configure Git
run: |
git config --global user.name "YaST Bot"
git config --global user.email "yast-devel@opensuse.org"
- name: Update web POT file
run: |
mkdir -p agama-weblate/web
cp agama/web/agama.pot agama-weblate/web/agama.pot
# any change besides the timestamp in the POT file?
- name: Check web POT changes
id: check_changes
run: |
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" web/agama.pot > pot.diff
if [ -s pot.diff ]; then
echo "POT file updated"
echo "pot_updated=true" >> $GITHUB_OUTPUT
else
echo "POT file unchanged"
echo "pot_updated=false" >> $GITHUB_OUTPUT
# reset any possible changes so they are not accidentally committed later
git -C agama-weblate reset --hard
fi
- name: Push updated web POT file
# run only when the POT file has been updated
if: steps.check_changes.outputs.pot_updated == 'true'
run: |
cd agama-weblate
git add web/agama.pot
git commit -m "Update web POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
git push
- name: Merge new POT to web translations
# run only when the POT file has been updated
if: steps.check_changes.outputs.pot_updated == 'true'
run: |
cd agama-weblate/web
find . -name "*.po" -exec msgmerge -U "{}" agama.pot \;
git commit -a -m "Merge new POT file to web translations"$'\n\n'"Agama commit: $GITHUB_SHA"
git push
- name: Install NPM packages
run: |
cd agama/.github/workflows/product_translations
npm ci
- name: Generate products POT file
run: |
cd agama/products.d
../.github/workflows/product_translations/products_pot *.yaml > products.pot
msgfmt --statistics products.pot
- name: Validate the generated products POT file
run: msgfmt --check-format agama/products.d/products.pot
- name: Update products POT file
run: |
mkdir -p agama-weblate/products
cp agama/products.d/products.pot agama-weblate/products/products.pot
# any change besides the timestamp in the POT file?
- name: Check products POT changes
id: check_changes_products
run: |
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" products/products.pot > pot.diff
if [ -s pot.diff ]; then
echo "POT file updated"
echo "pot_updated=true" >> $GITHUB_OUTPUT
else
echo "POT file unchanged"
echo "pot_updated=false" >> $GITHUB_OUTPUT
fi
- name: Push updated products POT file
# run only when the POT file has been updated
if: steps.check_changes_products.outputs.pot_updated == 'true'
run: |
cd agama-weblate
git add products/products.pot
git commit -m "Update products POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
git push
- name: Merge new POT to product translations
# run only when the POT file has been updated
if: steps.check_changes_products.outputs.pot_updated == 'true'
run: |
cd agama-weblate/products
find . -name "*.po" -exec msgmerge -U '{}' products.pot \;
git commit -a -m "Merge new POT file to product translations"$'\n\n'"Agama commit: $GITHUB_SHA"
git push
- name: Generate service POT file
run: |
cd agama
rake pot
msgfmt --statistics agama.pot
- name: Validate the generated service POT file
run: msgfmt --check-format agama/agama.pot
- name: Update service POT file
run: |
mkdir -p agama-weblate/service
cp agama/agama.pot agama-weblate/service/agama.pot
# any change besides the timestamp in the POT file?
- name: Check service POT changes
id: check_service_changes
run: |
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" service/agama.pot > pot.diff
if [ -s pot.diff ]; then
echo "POT file updated"
echo "pot_updated=true" >> $GITHUB_OUTPUT
else
echo "POT file unchanged"
echo "pot_updated=false" >> $GITHUB_OUTPUT
# reset any possible changes so they are not accidentally committed later
git -C agama-weblate reset --hard
fi
- name: Push updated service POT file
# run only when the POT file has been updated
if: steps.check_service_changes.outputs.pot_updated == 'true'
run: |
cd agama-weblate
git add service/agama.pot
git commit -m "Update service POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
git push
- name: Merge service POT to service translations
# run only when the POT file has been updated
if: steps.check_service_changes.outputs.pot_updated == 'true'
run: |
cd agama-weblate/service
find . -name "*.po" -exec msgmerge -U "{}" agama.pot \;
git commit -a -m "Merge new POT file to service translations"$'\n\n'"Agama commit: $GITHUB_SHA"
git push