Skip to content

Update l10n cron job #1162

Update l10n cron job

Update l10n cron job #1162

Workflow file for this run

name: Update l10n cron job
on:
schedule:
- cron: '0 3 * * *'
jobs:
l10n:
runs-on: ubuntu-22.04
name: Update l10n cron job
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- branch: prod-2-7
base_url: https://geomapfish-demo-2-7.camptocamp.com/
- branch: prod-2-8
base_url: https://geomapfish-demo-2-8.camptocamp.com/
- branch: prod-2-9
base_url: https://geomapfish-demo-2-8.camptocamp.com/
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
token: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}
- run: touch env.secrets
- run: ./build --env
- run: PROJECT_PUBLIC_URL=${{ matrix.base_url }} make -e update-po-from-url
- name: Init Git
run: |
git config --global user.email "[email protected]"
git config --global user.name CI
- id: status
run: echo "status=$(git diff --exit-code --quiet && echo 'unchanged' || echo 'changed')" >> $GITHUB_OUTPUT
- name: Push l10n branch and create pull request
run: |
sudo chown -R $(id -u) .
git add --all || true
git status
git commit -m "Update the l10n files"
git push --force origin HEAD:l10n-${{ matrix.branch }}
python3 -c "import requests
response = requests.post(
'https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls',
json={
'title': 'Update the l10n files on ${{ matrix.branch }}',
'body': '',
'head': 'l10n-${{ matrix.branch }}',
'base': '${{ matrix.branch }}',
'maintainer_can_modify': True
},
headers={
'Accept': 'application/vnd.github.v3+json',
'Authorization': 'Bearer ${{ secrets.GOPASS_CI_GITHUB_TOKEN }}',
'Content-Type': 'application/json',
},
timeout=120,
)
# 422 is the return code when the pull request already exists
assert response.status_code < 300 or response.status_code == 422, f'{response.status_code} - {response.text}'"
if: steps.status.outputs.status != 'unchanged'