New releases (#669) #195
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update source strings | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- repository-map.yml | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update_pot: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install gettext | |
run: sudo apt-get install gettext | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Update po templates (merging with existing) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python scripts/02_update_catalogs.py | |
- name: Create a PR optionally | |
shell: bash | |
env: | |
GITHUB_USER: ${{ secrets.GITHUB_USER }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -eux | |
if [[ ! -z "$(git status --porcelain *.pot crowdin.yml)" ]]; then | |
export COMMIT_SHA=$(git rev-parse --short HEAD) | |
export BRANCH_NAME=pot-update-${COMMIT_SHA} | |
git checkout -b "${BRANCH_NAME}" | |
git config user.name "JupyterLab Language Packs Bot" | |
git config user.email 'jupyterlab-bot@users.noreply.github.com' | |
git add *.pot crowdin.yml | |
git commit -m "Update pot files" | |
git push --set-upstream origin "${BRANCH_NAME}" | |
gh pr create -B "main" -t "Update pot files" -b "New changes to pot files were detected in ${COMMIT_SHA} commit." | |
fi |