/
githubmirror
/
julia
Обзор
Документация
Войти
/
githubmirror
/
julia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
.github/workflows/Typos.yml
70 строк
3 KB
dependabot[bot]
build(deps): bump actions/checkout from 7.0.0 to 7.0.1 (#62601)
01 авг 2026, 13:09
Не верифицирован
01 авг 2026, 13:09
118c2a1
Код
Авторство
О чём код?
name: Typos permissions: {} on: [pull_request] jobs: typos-check: name: Check for new typos runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Checkout the JuliaLang/julia repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Check spelling with typos #uses: crate-ci/typos@c7af4712eda24dd1ef54bd8212973888489eb0ce # v1.23.5 env: GH_TOKEN: "${{ github.token }}" run: | git fetch --depth=1 origin ${{ github.base_ref }} OLD_FILES=$(git diff-index --name-only --diff-filter=ad FETCH_HEAD) NEW_FILES=$(git diff-index --name-only --diff-filter=d FETCH_HEAD) # This is necessary because the typos command interprets the # empty string as "check all files" rather than "check no files". if [ -z "$NEW_FILES" ]; then echo "All edited files were deleted. Skipping typos check." exit 0 fi mkdir -p "${{ runner.temp }}/typos" RELEASE_ASSET_URL="$( gh api /repos/crate-ci/typos/releases/latest \ --jq '."assets"[] | select(."name" | test("^typos-.+-x86_64-unknown-linux-musl\\.tar\\.gz$")) | ."browser_download_url"' )" wget --secure-protocol=TLSv1_3 --max-redirect=1 --retry-on-host-error --retry-connrefused --tries=3 \ --quiet --output-document=- "${RELEASE_ASSET_URL}" \ | tar -xz -C "${{ runner.temp }}/typos" ./typos "${{ runner.temp }}/typos/typos" --version echo -n $NEW_FILES | xargs "${{ runner.temp }}/typos/typos" --config .github/_typos.toml --format json >> ${{ runner.temp }}/new_typos.jsonl || true git checkout FETCH_HEAD -- $OLD_FILES if [ -z "$OLD_FILES" ]; then touch "${{ runner.temp }}/old_typos.jsonl" # No old files, so no old typos. else echo -n $OLD_FILES | xargs "${{ runner.temp }}/typos/typos" --config .github/_typos.toml --format json >> ${{ runner.temp }}/old_typos.jsonl || true fi python -c ' import sys, json old = set() with open(sys.argv[1]) as old_file: for line in old_file: j = json.loads(line) if j["type"] == "typo": old.add(j["typo"]) clean = True with open(sys.argv[2]) as new_file: for line in new_file: new = json.loads(line) if new["type"] == "typo" and new["typo"] not in old: if len(new["typo"]) > 6: # Short typos might be false positives. Long are probably real. clean = False print("::warning file={},line={},col={}::perhaps \"{}\" should be \"{}\".".format( new["path"], new.get("line_num", 1), new["byte_offset"], new["typo"], " or ".join(new["corrections"]))) sys.exit(1 if not clean else 0)' "${{ runner.temp }}/old_typos.jsonl" "${{ runner.temp }}/new_typos.jsonl"