Skip to content

Automate pot file creation #1050

Automate pot file creation

Automate pot file creation #1050

name: Automate pot file creation
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
update-pot-file:
strategy:
# only one job at once otherwise one job will push and second job will get conflict on remote
max-parallel: 1
# update this matrix to support new Anaconda branches
matrix:
branch: [ master, f38, rhel-9 ]
include:
- branch: master
anaconda-branch: master
container-tag: master
- branch: f38
anaconda-branch: fedora-38
container-tag: fedora-38
- branch: rhel-9
anaconda-branch: rhel-9
container-tag: master
runs-on: ubuntu-latest
steps:
- name: Checkout anaconda ${{ matrix.anaconda-branch }}
uses: actions/checkout@v3
with:
path: anaconda
repository: rhinstaller/anaconda
ref: ${{ matrix.anaconda-branch }}
- name: Create pot file
run: |
podman run --rm -v ./anaconda:/anaconda:Z --workdir /anaconda quay.io/rhinstaller/anaconda-ci:${{ matrix.container-tag }} sh -c " \
./autogen.sh; \
./configure; \
make; \
make pot-update-check"
- name: Checkout anaconda-l10n
uses: actions/checkout@v3
with:
path: anaconda-l10n
ref: master
- name: Push new potfile
run: |
cp -v anaconda/po/anaconda.pot anaconda-l10n/${{ matrix.branch }}
cd anaconda-l10n
git config user.name github-actions
git config user.email github-actions@github.com
git add .
# test if the potfile needs update
# If there is any change except line with POT-Creation-Date we should push new version
if ! git diff -I 'POT-Creation-Date:' --cached --quiet; then
echo "The pot file did not change."
exit 0
else
git diff --cached
fi
git commit -m "update ${{ matrix.branch }} pot-file"
# do a 5 push retries in case weblate just pushed to the repository
# push from weblate could happen easily because webhook updates the translations
RETRIES=5
DELAY=2
COUNT=0
while [ $COUNT -lt $RETRIES ]; do
git pull --rebase
git push
if [ $? -eq 0 ]; then
exit 0
fi
let COUNT=$COUNT+1
sleep $DELAY
done
# retries were not successful
exit 1