Fetch new lexicons and regenerate code and docs #217
This file contains hidden or 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: Fetch new lexicons and regenerate code and docs | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 12 * * 5' # at 12:00 on Friday day | |
| permissions: | |
| contents: read | |
| jobs: | |
| update_lexicons: | |
| runs-on: ubuntu-latest | |
| env: | |
| POETRY_VIRTUALENVS_IN_PROJECT: "true" | |
| steps: | |
| - name: Checkout repository. | |
| uses: actions/checkout@v5 | |
| - name: Set up Python. | |
| id: setup-python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.9' | |
| - name: Load cached Poetry installation. | |
| id: cached-poetry | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.local | |
| key: poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-2.2.1 # bump the suffix to reset the cache | |
| - name: Setup Poetry. | |
| if: steps.cached-poetry.outputs.cache-hit != 'true' | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: 2.2.1 | |
| - name: Add Poetry to PATH. | |
| run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| - name: Load cached venv. | |
| id: cached-venv | |
| # "full" prefix shares the venv with codegen.yml (same full install). | |
| uses: actions/cache@v5 | |
| with: | |
| path: .venv | |
| key: venv-full-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies. | |
| if: steps.cached-venv.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction | |
| - name: Update lexicons and regen. | |
| id: regen | |
| run: | | |
| source "$(poetry env info -p)/bin/activate" | |
| poetry run python update_lexicons.py | |
| - name: Create Pull Request. | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| committer: Ilya (Marshal) <ilya@marshal.dev> | |
| author: Ilya (Marshal) <ilya@marshal.dev> | |
| commit-message: ${{ steps.regen.outputs.commit_message }} | |
| body: This PR was automatically generated | |
| base: main | |
| branch: update-lexicons | |
| title: ${{ steps.regen.outputs.commit_message }} | |
| assignees: MarshalX |