FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use self-repository workflow syntax with scoped actionlint ignore · python/python-docs-pl@a157f61 · GitHub

Repository navigation

Pospell check

Pospell check #9

Workflow file for this run

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: spellcheck
on:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
version:
description: CPython documentation version
required: true
type: string
translations-ref:
description: Translation branch updated by the calling workflow
required: true
type: string
secrets:
TX_TOKEN:
description: Transifex API token with access to the Polish terminology glossary
required: true
permissions:
contents: read
jobs:
pospell:
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: cpython/Doc
steps:
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Check out CPython documentation
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: python/cpython
ref: ${{ inputs.version || github.base_ref || github.ref_name }}
path: cpython
persist-credentials: false
- name: Check out translations
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.translations-ref }}
path: cpython/Doc/locales/pl/LC_MESSAGES
persist-credentials: false
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl hunspell hunspell-pl unzip
make venv
# Pospell needs newer Docutils than the Sphinx used by older branches.
uv venv "$RUNNER_TEMP/spellcheck-venv"
uv pip install --python "$RUNNER_TEMP/spellcheck-venv/bin/python" sphinx-intl pospell transifex-python six
- name: Prepare UTF-8 Polish dictionary
# The packaged dictionary uses ISO-8859-2, which cannot represent all prose.
run: |
mkdir -p "$RUNNER_TEMP/hunspell-utf8"
dictionary_encoding=$(sed -n 's/^SET //p' /usr/share/hunspell/pl_PL.aff)
iconv -f "$dictionary_encoding" -t UTF-8 /usr/share/hunspell/pl_PL.aff \
> "$RUNNER_TEMP/hunspell-utf8/pl_PL.aff"
sed -i 's/^SET .*/SET UTF-8/' "$RUNNER_TEMP/hunspell-utf8/pl_PL.aff"
iconv -f "$dictionary_encoding" -t UTF-8 /usr/share/hunspell/pl_PL.dic \
> "$RUNNER_TEMP/hunspell-utf8/pl_PL.dic"
- name: Download SJP Polish dictionary
run: |
curl --fail --location --retry 3 \
https://sjp.pl/sl/ort/sjp-hunspell-pl-20260901.zip \
--output "$RUNNER_TEMP/sjp-hunspell.zip"
echo "47a5ab02cf3def374994b1b03efd9fed2de868349b8ddcebac281b484353d157 $RUNNER_TEMP/sjp-hunspell.zip" \
| sha256sum --check --strict
# SJP wraps the dictionary files in a second ZIP archive.
unzip -p "$RUNNER_TEMP/sjp-hunspell.zip" pl_PL.zip \
> "$RUNNER_TEMP/sjp-pl_PL.zip"
unzip -p "$RUNNER_TEMP/sjp-pl_PL.zip" pl_PL.aff \
> "$RUNNER_TEMP/sjp-pl_PL.aff"
unzip -p "$RUNNER_TEMP/sjp-pl_PL.zip" pl_PL.dic \
> "$RUNNER_TEMP/sjp-pl_PL.dic"
dictionary_encoding=$(sed -n 's/^SET //p' "$RUNNER_TEMP/sjp-pl_PL.aff")
iconv -f "$dictionary_encoding" -t UTF-8 "$RUNNER_TEMP/sjp-pl_PL.aff" \
> "$RUNNER_TEMP/hunspell-utf8/pl_SJP.aff"
sed -i 's/^SET .*/SET UTF-8/' "$RUNNER_TEMP/hunspell-utf8/pl_SJP.aff"
iconv -f "$dictionary_encoding" -t UTF-8 "$RUNNER_TEMP/sjp-pl_PL.dic" \
> "$RUNNER_TEMP/hunspell-utf8/pl_SJP.dic"
- name: Download Polish terminology glossary
working-directory: cpython/Doc/locales/pl/LC_MESSAGES
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: >
"$RUNNER_TEMP/spellcheck-venv/bin/python"
manage_translation.py fetch_glossary
--output "$RUNNER_TEMP/hunspell-glossary.dic"
- name: Generate POT files without literal blocks
run: |
if make -n gettext >/dev/null 2>&1; then
make gettext SPHINXOPTS="-D gettext_additional_targets=index -D gettext_compact=0"
else
# CPython 3.10 and 3.11 do not have a dedicated gettext target.
make build BUILDER=gettext SPHINXOPTS="-D gettext_additional_targets=index -D gettext_compact=0"
fi
- name: Update temporary PO files
# Drop obsolete entries so removed literal blocks are not spellchecked.
run: >
"$RUNNER_TEMP/spellcheck-venv/bin/sphinx-intl" update -p build/gettext -d locales
-l pl
--no-obsolete
- name: Check Polish spelling
env:
DICPATH: ${{ runner.temp }}/hunspell-utf8
run: >
"$RUNNER_TEMP/spellcheck-venv/bin/pospell" --language pl_PL,pl_SJP
--personal-dict "$RUNNER_TEMP/hunspell-glossary.dic"
--glob 'locales/pl/LC_MESSAGES/**/*.po'
# PO updates exist only in this disposable checkout; nothing is committed.

Back | FazBrowse Home | New Git URL