From 7936d8c83b6e4e16dc451a3ad640a8c798524007 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Jan 2025 11:03:33 -0800 Subject: [PATCH 01/27] Update spellcheck to run only on changed files --- .github/workflows/spelling.yml | 82 ++++++++++++++++++++++++++++++++-- .pyspelling.yml | 7 +-- 2 files changed, 80 insertions(+), 9 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 07c86ed4a28..cca022b91ba 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -5,16 +5,90 @@ on: push: branches: - main + jobs: pyspelling: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - name: Check for skip label + if: github.event_name == 'pull_request' + id: skip-label + uses: actions/github-script@v6 + with: + script: | + const { data: labels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + const skipLabel = labels.find(label => label.name === 'skip-spell-check'); + if (skipLabel) { + console.log('Found skip-spell-check label, skipping spell check'); + core.setOutput('skip', 'true'); + } else { + core.setOutput('skip', 'false'); + } + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true' + with: + fetch-depth: 0 + + - name: Get changed files + if: github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true' + id: changed-files + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD -- \ + './*.{rst,md}' \ + 'beginner_source/**/*.{py,rst,md}' \ + 'intermediate_source/**/*.{py,rst,md}' \ + 'advanced_source/**/*.{py,rst,md}' \ + 'recipes_source/**/*.{py,rst,md}' \ + 'prototype_source/**/*.{py,rst,md}') + else + CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- \ + './*.{rst,md}' \ + 'beginner_source/**/*.{py,rst,md}' \ + 'intermediate_source/**/*.{py,rst,md}' \ + 'advanced_source/**/*.{py,rst,md}' \ + 'recipes_source/**/*.{py,rst,md}' \ + 'prototype_source/**/*.{py,rst,md}') + fi + echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT + + - name: Check if relevant files changed + if: github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true' + id: check + run: | + if [ -z "${{ steps.changed-files.outputs.files }}" ]; then + echo "skip=true" >> $GITHUB_OUTPUT + echo "No relevant files changed in monitored directories, skipping spell check" + else + echo "skip=false" >> $GITHUB_OUTPUT + echo "Found changed files to check:" + echo "${{ steps.changed-files.outputs.files }}" + fi + - uses: actions/setup-python@v4 + if: | + (github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true') && + steps.check.outputs.skip != 'true' with: python-version: '3.9' cache: 'pip' - - run: pip install pyspelling - - run: sudo apt-get install aspell aspell-en - - run: pyspelling + - name: Install dependencies + if: | + (github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true') && + steps.check.outputs.skip != 'true' + run: | + pip install pyspelling + sudo apt-get install aspell aspell-en + + - name: Run pyspelling + if: | + (github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true') && + steps.check.outputs.skip != 'true' + run: | + pyspelling --source "${{ steps.changed-files.outputs.files }}" diff --git a/.pyspelling.yml b/.pyspelling.yml index 1afe6dbb45e..1dd2a4b053e 100644 --- a/.pyspelling.yml +++ b/.pyspelling.yml @@ -2,10 +2,7 @@ spellchecker: aspell matrix: - name: python sources: - - beginner_source/*.py - - intermediate_source/*.py - - advanced_source/*.py - - recipes_source/*/*.py + - "**/*.py" dictionary: wordlists: - en-wordlist.txt @@ -56,7 +53,7 @@ matrix: - pyspelling.filters.url: - name: reST sources: - - beginner_source/*.rst + - "**/*.rst" dictionary: wordlists: - en-wordlist.txt From 598d710de21f58dc5c7fa83f7f9c309eaec956fe Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Jan 2025 13:19:05 -0800 Subject: [PATCH 02/27] Update spelling.yml --- .github/workflows/spelling.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index cca022b91ba..e3a382cd462 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -40,7 +40,7 @@ jobs: run: | if [ "${{ github.event_name }}" == "pull_request" ]; then CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD -- \ - './*.{rst,md}' \ + '*.rst' '*.md' \ 'beginner_source/**/*.{py,rst,md}' \ 'intermediate_source/**/*.{py,rst,md}' \ 'advanced_source/**/*.{py,rst,md}' \ @@ -48,7 +48,7 @@ jobs: 'prototype_source/**/*.{py,rst,md}') else CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- \ - './*.{rst,md}' \ + '*.rst' '*.md' \ 'beginner_source/**/*.{py,rst,md}' \ 'intermediate_source/**/*.{py,rst,md}' \ 'advanced_source/**/*.{py,rst,md}' \ From 885a7ae00b9e4f3400e664c26570c74ccecfad95 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Jan 2025 14:23:45 -0800 Subject: [PATCH 03/27] Update --- .github/workflows/spelling.yml | 100 +++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 42 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index e3a382cd462..44a0cfcabd4 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -10,69 +10,80 @@ jobs: pyspelling: runs-on: ubuntu-20.04 steps: - - name: Check for skip label - if: github.event_name == 'pull_request' - id: skip-label + - name: Check for skip label and get changed files + id: check-files uses: actions/github-script@v6 with: script: | - const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number - }); - const skipLabel = labels.find(label => label.name === 'skip-spell-check'); - if (skipLabel) { - console.log('Found skip-spell-check label, skipping spell check'); - core.setOutput('skip', 'true'); + let skipCheck = false; + let changedFiles = []; + + if (context.eventName === 'pull_request') { + // Check for skip label + const { data: labels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + skipCheck = labels.some(label => label.name === 'skip-spell-check'); + + if (!skipCheck) { + // Get changed files in PR + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + changedFiles = files + .filter(file => file.filename.match(/\.(py|rst|md)$/)) + .map(file => file.filename); + } } else { - core.setOutput('skip', 'false'); + // For push events, we'll still need to use git diff + // We'll handle this after checkout } + + core.setOutput('skip', skipCheck.toString()); + core.setOutput('files', changedFiles.join(' ')); + core.setOutput('is-pr', (context.eventName === 'pull_request').toString()); - uses: actions/checkout@v4 - if: github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true' + if: steps.check-files.outputs.skip != 'true' with: fetch-depth: 0 - - name: Get changed files - if: github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true' - id: changed-files + - name: Get changed files for push event + if: | + steps.check-files.outputs.skip != 'true' && + steps.check-files.outputs.is-pr != 'true' + id: push-files run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD -- \ - '*.rst' '*.md' \ - 'beginner_source/**/*.{py,rst,md}' \ - 'intermediate_source/**/*.{py,rst,md}' \ - 'advanced_source/**/*.{py,rst,md}' \ - 'recipes_source/**/*.{py,rst,md}' \ - 'prototype_source/**/*.{py,rst,md}') - else - CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- \ - '*.rst' '*.md' \ - 'beginner_source/**/*.{py,rst,md}' \ - 'intermediate_source/**/*.{py,rst,md}' \ - 'advanced_source/**/*.{py,rst,md}' \ - 'recipes_source/**/*.{py,rst,md}' \ - 'prototype_source/**/*.{py,rst,md}') - fi + CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md') echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT - name: Check if relevant files changed - if: github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true' + if: steps.check-files.outputs.skip != 'true' id: check run: | - if [ -z "${{ steps.changed-files.outputs.files }}" ]; then + if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then + FILES="${{ steps.check-files.outputs.files }}" + else + FILES="${{ steps.push-files.outputs.files }}" + fi + + if [ -z "$FILES" ]; then echo "skip=true" >> $GITHUB_OUTPUT - echo "No relevant files changed in monitored directories, skipping spell check" + echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check" else echo "skip=false" >> $GITHUB_OUTPUT echo "Found changed files to check:" - echo "${{ steps.changed-files.outputs.files }}" + echo "$FILES" fi - uses: actions/setup-python@v4 if: | - (github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true') && + steps.check-files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' with: python-version: '3.9' @@ -80,7 +91,7 @@ jobs: - name: Install dependencies if: | - (github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true') && + steps.check-files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' run: | pip install pyspelling @@ -88,7 +99,12 @@ jobs: - name: Run pyspelling if: | - (github.event_name != 'pull_request' || steps.skip-label.outputs.skip != 'true') && + steps.check-files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' run: | - pyspelling --source "${{ steps.changed-files.outputs.files }}" + if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then + FILES="${{ steps.check-files.outputs.files }}" + else + FILES="${{ steps.push-files.outputs.files }}" + fi + pyspelling --source "$FILES" From 13cb423b518ba3b1c7be0e61666c1c6b0cc7ef95 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Fri, 17 Jan 2025 14:03:50 -0800 Subject: [PATCH 04/27] Update --- .github/workflows/spelling.yml | 45 +++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 44a0cfcabd4..3027f86f954 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -45,7 +45,7 @@ jobs: } core.setOutput('skip', skipCheck.toString()); - core.setOutput('files', changedFiles.join(' ')); + core.setOutput('files', changedFiles.join('\n')); core.setOutput('is-pr', (context.eventName === 'pull_request').toString()); - uses: actions/checkout@v4 @@ -60,7 +60,9 @@ jobs: id: push-files run: | CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md') - echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "files<> $GITHUB_OUTPUT + echo "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - name: Check if relevant files changed if: steps.check-files.outputs.skip != 'true' @@ -97,14 +99,45 @@ jobs: pip install pyspelling sudo apt-get install aspell aspell-en - - name: Run pyspelling + - name: Run spell check on each file if: | steps.check-files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' run: | + # Get the list of files into an array if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then - FILES="${{ steps.check-files.outputs.files }}" + mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}" else - FILES="${{ steps.push-files.outputs.files }}" + mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}" + fi + + # Check each file individually + FINAL_EXIT_CODE=0 + for file in "${FILES[@]}"; do + if [ -n "$file" ]; then + echo "Checking spelling in $file" + # Create a temporary config file based on the existing one + python3 - < temp_config.yml + import yaml + + with open('.pyspelling.yml', 'r') as f: + config = yaml.safe_load(f) + + # Modify only the sources in each matrix entry + for matrix in config['matrix']: + matrix['sources'] = ['$file'] + + with open('temp_config.yml', 'w') as f: + yaml.dump(config, f, default_flow_style=False) + EOF + + if ! pyspelling -c temp_config.yml; then + FINAL_EXIT_CODE=1 + fi + fi + done + + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "Spell check failed!" + exit 1 fi - pyspelling --source "$FILES" From f70420221eccd276aee7bf53647ed573a62a9482 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Tue, 21 Jan 2025 08:37:02 -0800 Subject: [PATCH 05/27] Simplify the script --- .github/workflows/spelling.yml | 129 ++++++++++----------------------- 1 file changed, 38 insertions(+), 91 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 3027f86f954..e69302259e6 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -8,136 +8,83 @@ on: jobs: pyspelling: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - name: Check for skip label and get changed files - id: check-files + - name: Get changed files and check skip label + id: files uses: actions/github-script@v6 with: script: | - let skipCheck = false; - let changedFiles = []; - if (context.eventName === 'pull_request') { // Check for skip label const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, + ...context.repo, issue_number: context.issue.number }); - skipCheck = labels.some(label => label.name === 'skip-spell-check'); - - if (!skipCheck) { - // Get changed files in PR - const { data: files } = await github.rest.pulls.listFiles({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number - }); - - changedFiles = files - .filter(file => file.filename.match(/\.(py|rst|md)$/)) - .map(file => file.filename); + if (labels.some(label => label.name === 'skip-spell-check')) { + core.setOutput('skip', 'true'); + return; } - } else { - // For push events, we'll still need to use git diff - // We'll handle this after checkout } - core.setOutput('skip', skipCheck.toString()); - core.setOutput('files', changedFiles.join('\n')); - core.setOutput('is-pr', (context.eventName === 'pull_request').toString()); + core.setOutput('skip', 'false'); - uses: actions/checkout@v4 - if: steps.check-files.outputs.skip != 'true' + if: steps.files.outputs.skip != 'true' with: fetch-depth: 0 - - name: Get changed files for push event - if: | - steps.check-files.outputs.skip != 'true' && - steps.check-files.outputs.is-pr != 'true' - id: push-files - run: | - CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md') - echo "files<> $GITHUB_OUTPUT - echo "$CHANGED_FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - - name: Check if relevant files changed - if: steps.check-files.outputs.skip != 'true' + - name: Get files to check + if: steps.files.outputs.skip != 'true' id: check run: | - if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then - FILES="${{ steps.check-files.outputs.files }}" + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files[].path' | grep -E '\.(py|rst|md)$' || true) else - FILES="${{ steps.push-files.outputs.files }}" + FILES=$(git diff --name-only HEAD^..HEAD | grep -E '\.(py|rst|md)$' || true) fi if [ -z "$FILES" ]; then echo "skip=true" >> $GITHUB_OUTPUT - echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check" + echo "No relevant files changed" else + echo "files<> $GITHUB_OUTPUT + echo "$FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT echo "skip=false" >> $GITHUB_OUTPUT - echo "Found changed files to check:" + echo "Files to check:" echo "$FILES" fi + env: + GH_TOKEN: ${{ github.token }} - uses: actions/setup-python@v4 - if: | - steps.check-files.outputs.skip != 'true' && - steps.check.outputs.skip != 'true' + if: steps.files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' with: python-version: '3.9' cache: 'pip' - name: Install dependencies - if: | - steps.check-files.outputs.skip != 'true' && - steps.check.outputs.skip != 'true' + if: steps.files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' run: | pip install pyspelling sudo apt-get install aspell aspell-en - - name: Run spell check on each file - if: | - steps.check-files.outputs.skip != 'true' && - steps.check.outputs.skip != 'true' + - name: Run spell check + if: steps.files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' run: | - # Get the list of files into an array - if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then - mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}" - else - mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}" - fi - - # Check each file individually - FINAL_EXIT_CODE=0 - for file in "${FILES[@]}"; do + while IFS= read -r file; do if [ -n "$file" ]; then - echo "Checking spelling in $file" - # Create a temporary config file based on the existing one - python3 - < temp_config.yml - import yaml - - with open('.pyspelling.yml', 'r') as f: - config = yaml.safe_load(f) - - # Modify only the sources in each matrix entry - for matrix in config['matrix']: - matrix['sources'] = ['$file'] - - with open('temp_config.yml', 'w') as f: - yaml.dump(config, f, default_flow_style=False) - EOF - - if ! pyspelling -c temp_config.yml; then - FINAL_EXIT_CODE=1 - fi + echo "Checking $file" + python -c " + import yaml + with open('.pyspelling.yml') as config_file: + config = yaml.safe_load(config_file) + for matrix_entry in config['matrix']: + matrix_entry['sources'] = ['$file'] + with open('temp_config.yml', 'w') as output_file: + yaml.dump(config, output_file) + " + pyspelling -c temp_config.yml || exit 1 fi - done - - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "Spell check failed!" - exit 1 - fi + done <<< "${{ steps.check.outputs.files }}" From 704eb213071f69ee06bff0754749b074c696885e Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 11:51:32 -0800 Subject: [PATCH 06/27] Test .md, .rst, .py --- README.md | 4 ++-- beginner_source/colab.rst | 6 +++--- beginner_source/introyt/tensors_deeper_tutorial.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index af84d9ebe79..f17f7f5e3d9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ All the tutorials are now presented as sphinx style documentation at: # Asking a question -If you have a question about a tutorial, post in https://dev-discuss.pytorch.org/ rather than creating an issue in this repo. Your question will be answered much faster on the dev-discuss forum. +If you hve a qestion about a tutorial, post in https://dev-discuss.pytorch.org/ rather than creating an issue in this repo. Your question will be answered much faster on the dev-discuss forum. # Submitting an issue @@ -20,7 +20,7 @@ You can submit the following types of issues: We use sphinx-gallery's [notebook styled examples](https://sphinx-gallery.github.io/stable/tutorials/index.html) to create the tutorials. Syntax is very simple. In essence, you write a slightly well formatted Python file and it shows up as an HTML page. In addition, a Jupyter notebook is autogenerated and available to run in Google Colab. -Here is how you can create a new tutorial (for a detailed description, see [CONTRIBUTING.md](./CONTRIBUTING.md)): +Here is how you can ceate a new tutorial (for a detailed description, see [CONTRIBUTING.md](./CONTRIBUTING.md)): NOTE: Before submitting a new tutorial, read [PyTorch Tutorial Submission Policy](./tutorial_submission_policy.md). diff --git a/beginner_source/colab.rst b/beginner_source/colab.rst index 812255704e7..329f4884666 100644 --- a/beginner_source/colab.rst +++ b/beginner_source/colab.rst @@ -10,8 +10,8 @@ run PyTorch tutorials in Google Colab. PyTorch Version in Google Colab ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When you are running a tutorial that requires a version of PyTorch that has -just been released, that version might not be yet available in Google Colab. +Wen you are running a tutorial that requires a version of PyTorch that has +jst been released, that version might not be yet available in Google Colab. To check that you have the required ``torch`` and compatible domain libraries installed, run ``!pip list``. @@ -27,7 +27,7 @@ Using Tutorial Data from Google Drive in Colab ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We've added a new feature to tutorials that allows users to open the -notebook associated with a tutorial in Google Colab. You may need to +ntebook associated with a tutorial in Google Colab. You may need to copy data to your Google drive account to get the more complex tutorials to work. diff --git a/beginner_source/introyt/tensors_deeper_tutorial.py b/beginner_source/introyt/tensors_deeper_tutorial.py index d7293dfe295..b9019469995 100644 --- a/beginner_source/introyt/tensors_deeper_tutorial.py +++ b/beginner_source/introyt/tensors_deeper_tutorial.py @@ -44,7 +44,7 @@ ########################################################################## -# Let’s unpack what we just did: +# Let’s upack what we just did: # # - We created a tensor using one of the numerous factory methods # attached to the ``torch`` module. @@ -85,7 +85,7 @@ ######################################################################### -# The factory methods all do just what you’d expect - we have a tensor +# The fctory methods all do just what you’d expect - we have a tensor # full of zeros, another full of ones, and another with random values # between 0 and 1. # From 699cb87b95017a3d2465d42776c122a0246c4182 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 11:58:10 -0800 Subject: [PATCH 07/27] Revert to 13cb423b --- .github/workflows/spelling.yml | 129 +++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 38 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index e69302259e6..3027f86f954 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -8,83 +8,136 @@ on: jobs: pyspelling: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - name: Get changed files and check skip label - id: files + - name: Check for skip label and get changed files + id: check-files uses: actions/github-script@v6 with: script: | + let skipCheck = false; + let changedFiles = []; + if (context.eventName === 'pull_request') { // Check for skip label const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - ...context.repo, + owner: context.repo.owner, + repo: context.repo.repo, issue_number: context.issue.number }); - if (labels.some(label => label.name === 'skip-spell-check')) { - core.setOutput('skip', 'true'); - return; + skipCheck = labels.some(label => label.name === 'skip-spell-check'); + + if (!skipCheck) { + // Get changed files in PR + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + changedFiles = files + .filter(file => file.filename.match(/\.(py|rst|md)$/)) + .map(file => file.filename); } + } else { + // For push events, we'll still need to use git diff + // We'll handle this after checkout } - core.setOutput('skip', 'false'); + core.setOutput('skip', skipCheck.toString()); + core.setOutput('files', changedFiles.join('\n')); + core.setOutput('is-pr', (context.eventName === 'pull_request').toString()); - uses: actions/checkout@v4 - if: steps.files.outputs.skip != 'true' + if: steps.check-files.outputs.skip != 'true' with: fetch-depth: 0 - - name: Get files to check - if: steps.files.outputs.skip != 'true' + - name: Get changed files for push event + if: | + steps.check-files.outputs.skip != 'true' && + steps.check-files.outputs.is-pr != 'true' + id: push-files + run: | + CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md') + echo "files<> $GITHUB_OUTPUT + echo "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Check if relevant files changed + if: steps.check-files.outputs.skip != 'true' id: check run: | - if [[ ${{ github.event_name }} == 'pull_request' ]]; then - FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files[].path' | grep -E '\.(py|rst|md)$' || true) + if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then + FILES="${{ steps.check-files.outputs.files }}" else - FILES=$(git diff --name-only HEAD^..HEAD | grep -E '\.(py|rst|md)$' || true) + FILES="${{ steps.push-files.outputs.files }}" fi if [ -z "$FILES" ]; then echo "skip=true" >> $GITHUB_OUTPUT - echo "No relevant files changed" + echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check" else - echo "files<> $GITHUB_OUTPUT - echo "$FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT echo "skip=false" >> $GITHUB_OUTPUT - echo "Files to check:" + echo "Found changed files to check:" echo "$FILES" fi - env: - GH_TOKEN: ${{ github.token }} - uses: actions/setup-python@v4 - if: steps.files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' + if: | + steps.check-files.outputs.skip != 'true' && + steps.check.outputs.skip != 'true' with: python-version: '3.9' cache: 'pip' - name: Install dependencies - if: steps.files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' + if: | + steps.check-files.outputs.skip != 'true' && + steps.check.outputs.skip != 'true' run: | pip install pyspelling sudo apt-get install aspell aspell-en - - name: Run spell check - if: steps.files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' + - name: Run spell check on each file + if: | + steps.check-files.outputs.skip != 'true' && + steps.check.outputs.skip != 'true' run: | - while IFS= read -r file; do + # Get the list of files into an array + if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then + mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}" + else + mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}" + fi + + # Check each file individually + FINAL_EXIT_CODE=0 + for file in "${FILES[@]}"; do if [ -n "$file" ]; then - echo "Checking $file" - python -c " - import yaml - with open('.pyspelling.yml') as config_file: - config = yaml.safe_load(config_file) - for matrix_entry in config['matrix']: - matrix_entry['sources'] = ['$file'] - with open('temp_config.yml', 'w') as output_file: - yaml.dump(config, output_file) - " - pyspelling -c temp_config.yml || exit 1 + echo "Checking spelling in $file" + # Create a temporary config file based on the existing one + python3 - < temp_config.yml + import yaml + + with open('.pyspelling.yml', 'r') as f: + config = yaml.safe_load(f) + + # Modify only the sources in each matrix entry + for matrix in config['matrix']: + matrix['sources'] = ['$file'] + + with open('temp_config.yml', 'w') as f: + yaml.dump(config, f, default_flow_style=False) + EOF + + if ! pyspelling -c temp_config.yml; then + FINAL_EXIT_CODE=1 + fi fi - done <<< "${{ steps.check.outputs.files }}" + done + + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "Spell check failed!" + exit 1 + fi From 7a54d1c89c90a1c626d75557b48c7bdc6df6d750 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 13:20:19 -0800 Subject: [PATCH 08/27] Update spelling.yml --- .github/workflows/spelling.yml | 114 +++++++++------------------------ 1 file changed, 30 insertions(+), 84 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 3027f86f954..feb206bffdc 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -10,8 +10,12 @@ jobs: pyspelling: runs-on: ubuntu-20.04 steps: - - name: Check for skip label and get changed files - id: check-files + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get changed files and check for skip label + id: changes uses: actions/github-script@v6 with: script: | @@ -21,123 +25,65 @@ jobs: if (context.eventName === 'pull_request') { // Check for skip label const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, + ...context.repo, issue_number: context.issue.number }); skipCheck = labels.some(label => label.name === 'skip-spell-check'); if (!skipCheck) { - // Get changed files in PR const { data: files } = await github.rest.pulls.listFiles({ - owner: context.repo.owner, - repo: context.repo.repo, + ...context.repo, pull_number: context.issue.number }); - changedFiles = files .filter(file => file.filename.match(/\.(py|rst|md)$/)) .map(file => file.filename); } } else { - // For push events, we'll still need to use git diff - // We'll handle this after checkout + // For push events + const exec = require('child_process').execSync; + changedFiles = exec('git diff --name-only HEAD^..HEAD -- "*.py" "*.rst" "*.md"') + .toString() + .trim() + .split('\n') + .filter(Boolean); } - core.setOutput('skip', skipCheck.toString()); + const shouldRun = !skipCheck && changedFiles.length > 0; + + core.setOutput('should-run', shouldRun); core.setOutput('files', changedFiles.join('\n')); - core.setOutput('is-pr', (context.eventName === 'pull_request').toString()); - - - uses: actions/checkout@v4 - if: steps.check-files.outputs.skip != 'true' - with: - fetch-depth: 0 - - - name: Get changed files for push event - if: | - steps.check-files.outputs.skip != 'true' && - steps.check-files.outputs.is-pr != 'true' - id: push-files - run: | - CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md') - echo "files<> $GITHUB_OUTPUT - echo "$CHANGED_FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - - name: Check if relevant files changed - if: steps.check-files.outputs.skip != 'true' - id: check - run: | - if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then - FILES="${{ steps.check-files.outputs.files }}" - else - FILES="${{ steps.push-files.outputs.files }}" - fi - - if [ -z "$FILES" ]; then - echo "skip=true" >> $GITHUB_OUTPUT - echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check" - else - echo "skip=false" >> $GITHUB_OUTPUT - echo "Found changed files to check:" - echo "$FILES" - fi - uses: actions/setup-python@v4 - if: | - steps.check-files.outputs.skip != 'true' && - steps.check.outputs.skip != 'true' + if: steps.changes.outputs.should-run == 'true' with: python-version: '3.9' cache: 'pip' - name: Install dependencies - if: | - steps.check-files.outputs.skip != 'true' && - steps.check.outputs.skip != 'true' + if: steps.changes.outputs.should-run == 'true' run: | pip install pyspelling sudo apt-get install aspell aspell-en - - name: Run spell check on each file - if: | - steps.check-files.outputs.skip != 'true' && - steps.check.outputs.skip != 'true' + - name: Run spell check + if: steps.changes.outputs.should-run == 'true' run: | - # Get the list of files into an array - if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then - mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}" - else - mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}" - fi + # Get the list of files + mapfile -t FILES <<< "${{ steps.changes.outputs.files }}" - # Check each file individually - FINAL_EXIT_CODE=0 + # Check each file for file in "${FILES[@]}"; do - if [ -n "$file" ]; then - echo "Checking spelling in $file" - # Create a temporary config file based on the existing one - python3 - < temp_config.yml + echo "Checking spelling in $file" + python3 - < temp_config.yml import yaml - with open('.pyspelling.yml', 'r') as f: config = yaml.safe_load(f) - - # Modify only the sources in each matrix entry for matrix in config['matrix']: matrix['sources'] = ['$file'] - with open('temp_config.yml', 'w') as f: - yaml.dump(config, f, default_flow_style=False) + yaml.dump(config, f) EOF - - if ! pyspelling -c temp_config.yml; then - FINAL_EXIT_CODE=1 - fi - fi + + pyspelling -c temp_config.yml || exit 1 done - - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "Spell check failed!" - exit 1 - fi From c1c58f4a036cb511cf2f6c8d4d297f43c59fea9e Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 13:29:17 -0800 Subject: [PATCH 09/27] Revert --- .github/workflows/spelling.yml | 114 ++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 30 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index feb206bffdc..3027f86f954 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -10,12 +10,8 @@ jobs: pyspelling: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get changed files and check for skip label - id: changes + - name: Check for skip label and get changed files + id: check-files uses: actions/github-script@v6 with: script: | @@ -25,65 +21,123 @@ jobs: if (context.eventName === 'pull_request') { // Check for skip label const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - ...context.repo, + owner: context.repo.owner, + repo: context.repo.repo, issue_number: context.issue.number }); skipCheck = labels.some(label => label.name === 'skip-spell-check'); if (!skipCheck) { + // Get changed files in PR const { data: files } = await github.rest.pulls.listFiles({ - ...context.repo, + owner: context.repo.owner, + repo: context.repo.repo, pull_number: context.issue.number }); + changedFiles = files .filter(file => file.filename.match(/\.(py|rst|md)$/)) .map(file => file.filename); } } else { - // For push events - const exec = require('child_process').execSync; - changedFiles = exec('git diff --name-only HEAD^..HEAD -- "*.py" "*.rst" "*.md"') - .toString() - .trim() - .split('\n') - .filter(Boolean); + // For push events, we'll still need to use git diff + // We'll handle this after checkout } - const shouldRun = !skipCheck && changedFiles.length > 0; - - core.setOutput('should-run', shouldRun); + core.setOutput('skip', skipCheck.toString()); core.setOutput('files', changedFiles.join('\n')); + core.setOutput('is-pr', (context.eventName === 'pull_request').toString()); + + - uses: actions/checkout@v4 + if: steps.check-files.outputs.skip != 'true' + with: + fetch-depth: 0 + + - name: Get changed files for push event + if: | + steps.check-files.outputs.skip != 'true' && + steps.check-files.outputs.is-pr != 'true' + id: push-files + run: | + CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md') + echo "files<> $GITHUB_OUTPUT + echo "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Check if relevant files changed + if: steps.check-files.outputs.skip != 'true' + id: check + run: | + if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then + FILES="${{ steps.check-files.outputs.files }}" + else + FILES="${{ steps.push-files.outputs.files }}" + fi + + if [ -z "$FILES" ]; then + echo "skip=true" >> $GITHUB_OUTPUT + echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check" + else + echo "skip=false" >> $GITHUB_OUTPUT + echo "Found changed files to check:" + echo "$FILES" + fi - uses: actions/setup-python@v4 - if: steps.changes.outputs.should-run == 'true' + if: | + steps.check-files.outputs.skip != 'true' && + steps.check.outputs.skip != 'true' with: python-version: '3.9' cache: 'pip' - name: Install dependencies - if: steps.changes.outputs.should-run == 'true' + if: | + steps.check-files.outputs.skip != 'true' && + steps.check.outputs.skip != 'true' run: | pip install pyspelling sudo apt-get install aspell aspell-en - - name: Run spell check - if: steps.changes.outputs.should-run == 'true' + - name: Run spell check on each file + if: | + steps.check-files.outputs.skip != 'true' && + steps.check.outputs.skip != 'true' run: | - # Get the list of files - mapfile -t FILES <<< "${{ steps.changes.outputs.files }}" + # Get the list of files into an array + if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then + mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}" + else + mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}" + fi - # Check each file + # Check each file individually + FINAL_EXIT_CODE=0 for file in "${FILES[@]}"; do - echo "Checking spelling in $file" - python3 - < temp_config.yml + if [ -n "$file" ]; then + echo "Checking spelling in $file" + # Create a temporary config file based on the existing one + python3 - < temp_config.yml import yaml + with open('.pyspelling.yml', 'r') as f: config = yaml.safe_load(f) + + # Modify only the sources in each matrix entry for matrix in config['matrix']: matrix['sources'] = ['$file'] + with open('temp_config.yml', 'w') as f: - yaml.dump(config, f) + yaml.dump(config, f, default_flow_style=False) EOF - - pyspelling -c temp_config.yml || exit 1 + + if ! pyspelling -c temp_config.yml; then + FINAL_EXIT_CODE=1 + fi + fi done + + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "Spell check failed!" + exit 1 + fi From a424a1aaeaa68d7ed4c0e2bc35d78275ebb91d25 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 13:33:09 -0800 Subject: [PATCH 10/27] Update --- .github/workflows/spelling.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 3027f86f954..266ce43a0dc 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -50,8 +50,6 @@ jobs: - uses: actions/checkout@v4 if: steps.check-files.outputs.skip != 'true' - with: - fetch-depth: 0 - name: Get changed files for push event if: | From 59c545e5da83673e635588b63eaa42fc1a84a301 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 13:55:07 -0800 Subject: [PATCH 11/27] Update --- .github/workflows/spelling.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 266ce43a0dc..b5998ef6000 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -120,22 +120,19 @@ jobs: with open('.pyspelling.yml', 'r') as f: config = yaml.safe_load(f) - - # Modify only the sources in each matrix entry + + new_matrix = [] for matrix in config['matrix']: - matrix['sources'] = ['$file'] - + d # Check if the file extension matches the matrix name + if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or + ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or + ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): + matrix_copy = matrix.copy() + matrix_copy['sources'] = ['$file'] + new_matrix.append(matrix_copy) + + config['matrix'] = new_matrix + with open('temp_config.yml', 'w') as f: yaml.dump(config, f, default_flow_style=False) EOF - - if ! pyspelling -c temp_config.yml; then - FINAL_EXIT_CODE=1 - fi - fi - done - - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "Spell check failed!" - exit 1 - fi From 179e0ec9a7155c272455b7646ebc7d3d34a28ce4 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 13:56:46 -0800 Subject: [PATCH 12/27] Update --- .github/workflows/spelling.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index b5998ef6000..62c88a9763d 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -123,7 +123,7 @@ jobs: new_matrix = [] for matrix in config['matrix']: - d # Check if the file extension matches the matrix name + # Check if the file extension matches the matrix name if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): From 4b2e8780a0d1bd6d5a9d37a9f1e45296530684c3 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 13:58:32 -0800 Subject: [PATCH 13/27] Update --- .github/workflows/spelling.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 62c88a9763d..c042c47849f 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -50,6 +50,8 @@ jobs: - uses: actions/checkout@v4 if: steps.check-files.outputs.skip != 'true' + with: + fetch-depth: 0 - name: Get changed files for push event if: | @@ -130,9 +132,9 @@ jobs: matrix_copy = matrix.copy() matrix_copy['sources'] = ['$file'] new_matrix.append(matrix_copy) - + config['matrix'] = new_matrix - + with open('temp_config.yml', 'w') as f: yaml.dump(config, f, default_flow_style=False) EOF From 9b046a7d8d6e32a3041ad227231d76e902f69c02 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 14:10:56 -0800 Subject: [PATCH 14/27] Update --- .github/workflows/spelling.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index c042c47849f..69cfad7f3a4 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -118,23 +118,23 @@ jobs: echo "Checking spelling in $file" # Create a temporary config file based on the existing one python3 - < temp_config.yml - import yaml +import yaml - with open('.pyspelling.yml', 'r') as f: - config = yaml.safe_load(f) +with open('.pyspelling.yml', 'r') as f: + config = yaml.safe_load(f) - new_matrix = [] - for matrix in config['matrix']: - # Check if the file extension matches the matrix name - if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or - ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or - ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): - matrix_copy = matrix.copy() - matrix_copy['sources'] = ['$file'] - new_matrix.append(matrix_copy) +new_matrix = [] +for matrix in config['matrix']: + +if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or + ('reST' in matrix['name'] and '$file'.endswith('.rst')) or + ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): + matrix_copy = matrix.copy() + matrix_copy['sources'] = ['$file'] + new_matrix.append(matrix_copy) - config['matrix'] = new_matrix +config['matrix'] = new_matrix - with open('temp_config.yml', 'w') as f: - yaml.dump(config, f, default_flow_style=False) - EOF +with open('temp_config.yml', 'w') as f: + yaml.dump(config, f, default_flow_style=False) +EOF From 555417deb5f56283dc251063da5a66e521a2fd96 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 14:13:26 -0800 Subject: [PATCH 15/27] Update --- .github/workflows/spelling.yml | 38 +++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 69cfad7f3a4..d2af6b267b6 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -116,25 +116,35 @@ jobs: for file in "${FILES[@]}"; do if [ -n "$file" ]; then echo "Checking spelling in $file" - # Create a temporary config file based on the existing one - python3 - < temp_config.yml + cat > temp_config.py << 'EOL' import yaml - + with open('.pyspelling.yml', 'r') as f: config = yaml.safe_load(f) - + new_matrix = [] for matrix in config['matrix']: - -if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or - ('reST' in matrix['name'] and '$file'.endswith('.rst')) or - ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): - matrix_copy = matrix.copy() - matrix_copy['sources'] = ['$file'] - new_matrix.append(matrix_copy) - + if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or + ('reST' in matrix['name'].lower() and '$file'.endswith('.rst')) or + ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): + matrix_copy = matrix.copy() + matrix_copy['sources'] = ['$file'] + new_matrix.append(matrix_copy) + config['matrix'] = new_matrix - + with open('temp_config.yml', 'w') as f: yaml.dump(config, f, default_flow_style=False) -EOF +EOL + python3 temp_config.py + + if ! pyspelling -c temp_config.yml; then + FINAL_EXIT_CODE=1 + fi + fi + done + + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "Spell check failed!" + exit 1 + fi From f0c7cb8226687d62038640705936e800aefee930 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 14:15:34 -0800 Subject: [PATCH 16/27] Update --- .github/workflows/spelling.yml | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index d2af6b267b6..eed41f490eb 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -116,27 +116,7 @@ jobs: for file in "${FILES[@]}"; do if [ -n "$file" ]; then echo "Checking spelling in $file" - cat > temp_config.py << 'EOL' -import yaml - -with open('.pyspelling.yml', 'r') as f: - config = yaml.safe_load(f) - -new_matrix = [] -for matrix in config['matrix']: - if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or - ('reST' in matrix['name'].lower() and '$file'.endswith('.rst')) or - ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))): - matrix_copy = matrix.copy() - matrix_copy['sources'] = ['$file'] - new_matrix.append(matrix_copy) - -config['matrix'] = new_matrix - -with open('temp_config.yml', 'w') as f: - yaml.dump(config, f, default_flow_style=False) -EOL - python3 temp_config.py + python3 -c "import yaml; config = yaml.safe_load(open('.pyspelling.yml')); new_matrix = [matrix.copy() for matrix in config['matrix'] if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))) and not matrix.update({'sources': ['$file']})]; config['matrix'] = new_matrix; yaml.dump(config, open('temp_config.yml', 'w'))" if ! pyspelling -c temp_config.yml; then FINAL_EXIT_CODE=1 @@ -148,3 +128,4 @@ EOL echo "Spell check failed!" exit 1 fi + From b35c163293d9e1680631ce0ed59e69f143d7f72e Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 14:38:54 -0800 Subject: [PATCH 17/27] Update --- .pyspelling.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.pyspelling.yml b/.pyspelling.yml index 1dd2a4b053e..17e5aac2a00 100644 --- a/.pyspelling.yml +++ b/.pyspelling.yml @@ -116,3 +116,48 @@ matrix: - open: '\.\.\s+(image|include|only)::' close: '$' - pyspelling.filters.url: + - name: markdown + sources: + - '**/*.md' + dictionary: + wordlists: + - en-wordlist.txt + pipeline: + - pyspelling.filters.markdown: + markdown_extensions: + - markdown.extensions.extra: + - markdown.extensions.admonition: + - markdown.extensions.codehilite: + - markdown.extensions.meta: + - markdown.extensions.tables: + - markdown.extensions.toc: + - pyspelling.filters.html: + comments: false + ignores: + - code + - pre + - tt + - img + - a + - table + - thead + - tbody + - th + - tr + - td + - pyspelling.filters.context: + context_visible_first: true + delimiters: + # Ignore code blocks + - open: '```[a-z]*\n' + close: '```\n' + # Ignore inline code + - open: '`' + close: '`' + # Ignore links + - open: '\[([^]]*)\]' + close: '\([^)]*\)' + # Ignore HTML comments + - open: '' + - pyspelling.filters.url: From bad177f35224030c1065d1691c6599a8f91ae0af Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 14:45:46 -0800 Subject: [PATCH 18/27] Update --- .pyspelling.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pyspelling.yml b/.pyspelling.yml index 17e5aac2a00..bce797e6559 100644 --- a/.pyspelling.yml +++ b/.pyspelling.yml @@ -116,7 +116,7 @@ matrix: - open: '\.\.\s+(image|include|only)::' close: '$' - pyspelling.filters.url: - - name: markdown +- name: markdown sources: - '**/*.md' dictionary: From 2f6ad745b1592f4e1f9912ec476b4c9331d0ab94 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 14:59:35 -0800 Subject: [PATCH 19/27] Add spellcheck comment --- .github/workflows/spelling.yml | 67 +++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index eed41f490eb..32b94e0bdb2 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -120,12 +120,77 @@ jobs: if ! pyspelling -c temp_config.yml; then FINAL_EXIT_CODE=1 + SPELLCHECK_LOG+="### $file\n$OUTPUT\n\n" fi fi done if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "Spell check failed!" + echo "spell_failed=true" >> $GITHUB_OUTPUT + echo "spell_log<> $GITHUB_OUTPUT + echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT exit 1 fi + - name: Check for existing comment + if: | + failure() && + steps.spellcheck.outputs.spell_failed == 'true' && + github.event_name == 'pull_request' + uses: actions/github-script@v6 + id: find-comment + with: + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('Spellcheck has failed') + ); + return botComment ? botComment.id : ''; + result-encoding: string + + - name: Post or update spell check comment + if: | + failure() && + steps.spellcheck.outputs.spell_failed == 'true' && + github.event_name == 'pull_request' + uses: actions/github-script@v6 + with: + script: | + const message = `Spellcheck has failed. Please review the log and address the issues. + + Here are a few tips: + - All PyTorch API objects must be in double backticks or use an intersphinx directive. Example: \`\`torch.nn\`\`, :func:\`torch.load\`. + - Consult en-wordlist.txt for spellings of some of the words. You can add a word to en-wordlist.txt if: + 1) It's a common abbreviation, like RNN. + 2) It's a word widely accepted in the industry. + - Please do not add words like \`dtype\`, \`torch.nn.Transformer\` to pass spellcheck. Instead wrap it in double backticks or use an intersphinx directive. + + Spell check log: + \`\`\` + ${process.env.SPELL_LOG} + \`\`\``; + + const commentId = '${{ steps.find-comment.outputs.result }}'; + if (commentId) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: parseInt(commentId), + body: message + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: message + }); + } + env: + SPELL_LOG: ${{ steps.spellcheck.outputs.spell_log }} From 34c814100f5644695ab47325bee19298d76cdec0 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 15:06:34 -0800 Subject: [PATCH 20/27] Update spellcheck comment --- .github/workflows/spelling.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 32b94e0bdb2..d6e8e7dce8c 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -104,7 +104,6 @@ jobs: steps.check-files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' run: | - # Get the list of files into an array if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}" else @@ -113,15 +112,16 @@ jobs: # Check each file individually FINAL_EXIT_CODE=0 + SPELLCHECK_LOG="" for file in "${FILES[@]}"; do if [ -n "$file" ]; then echo "Checking spelling in $file" python3 -c "import yaml; config = yaml.safe_load(open('.pyspelling.yml')); new_matrix = [matrix.copy() for matrix in config['matrix'] if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))) and not matrix.update({'sources': ['$file']})]; config['matrix'] = new_matrix; yaml.dump(config, open('temp_config.yml', 'w'))" - if ! pyspelling -c temp_config.yml; then + OUTPUT=$(pyspelling -c temp_config.yml 2>&1) || { FINAL_EXIT_CODE=1 SPELLCHECK_LOG+="### $file\n$OUTPUT\n\n" - fi + } fi done From e6fce04fa0614baea60225461e41ba6aca6340c7 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 15:14:51 -0800 Subject: [PATCH 21/27] Update spellcheck comment --- .github/workflows/spelling.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index d6e8e7dce8c..84a1b4c4ca8 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -100,6 +100,7 @@ jobs: sudo apt-get install aspell aspell-en - name: Run spell check on each file + id: spellcheck if: | steps.check-files.outputs.skip != 'true' && steps.check.outputs.skip != 'true' @@ -118,18 +119,21 @@ jobs: echo "Checking spelling in $file" python3 -c "import yaml; config = yaml.safe_load(open('.pyspelling.yml')); new_matrix = [matrix.copy() for matrix in config['matrix'] if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))) and not matrix.update({'sources': ['$file']})]; config['matrix'] = new_matrix; yaml.dump(config, open('temp_config.yml', 'w'))" - OUTPUT=$(pyspelling -c temp_config.yml 2>&1) || { + if ! OUTPUT=$(pyspelling -c temp_config.yml 2>&1); then FINAL_EXIT_CODE=1 - SPELLCHECK_LOG+="### $file\n$OUTPUT\n\n" - } + SPELLCHECK_LOG="${SPELLCHECK_LOG}### ${file}\n${OUTPUT}\n\n" + fi fi done - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "spell_failed=true" >> $GITHUB_OUTPUT + { + echo "spell_failed=${FINAL_EXIT_CODE}" >> $GITHUB_OUTPUT echo "spell_log<> $GITHUB_OUTPUT - echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT + echo "${SPELLCHECK_LOG}" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + } + + if [ $FINAL_EXIT_CODE -ne 0 ]; then exit 1 fi From a59c5059ff3d32ba12779311267cc318f4595c42 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 15:21:21 -0800 Subject: [PATCH 22/27] Update spellcheck comment --- .github/workflows/spelling.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 84a1b4c4ca8..3b61690b8bd 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -119,23 +119,28 @@ jobs: echo "Checking spelling in $file" python3 -c "import yaml; config = yaml.safe_load(open('.pyspelling.yml')); new_matrix = [matrix.copy() for matrix in config['matrix'] if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))) and not matrix.update({'sources': ['$file']})]; config['matrix'] = new_matrix; yaml.dump(config, open('temp_config.yml', 'w'))" - if ! OUTPUT=$(pyspelling -c temp_config.yml 2>&1); then + if OUTPUT=$(pyspelling -c temp_config.yml 2>&1); then + echo "No spelling errors found in $file" + else FINAL_EXIT_CODE=1 - SPELLCHECK_LOG="${SPELLCHECK_LOG}### ${file}\n${OUTPUT}\n\n" + echo "Spelling errors found in $file:" + echo "$OUTPUT" + SPELLCHECK_LOG+="### $file\n$OUTPUT\n\n" fi fi done - { - echo "spell_failed=${FINAL_EXIT_CODE}" >> $GITHUB_OUTPUT - echo "spell_log<> $GITHUB_OUTPUT - echo "${SPELLCHECK_LOG}" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - } + # Save the results to GITHUB_OUTPUT + echo "spell_failed=$FINAL_EXIT_CODE" >> $GITHUB_OUTPUT + echo "spell_log<> $GITHUB_OUTPUT + echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT + echo "SPELLEOF" >> $GITHUB_OUTPUT if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "Spell check failed! See above for details." exit 1 fi + - name: Check for existing comment if: | From a1a72ab36ceef0c8546c62c32fbd21e6303ab6f1 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 15:27:43 -0800 Subject: [PATCH 23/27] Update spellcheck comment --- .github/workflows/spelling.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 3b61690b8bd..e3dd1657f5d 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -141,16 +141,15 @@ jobs: exit 1 fi - - name: Check for existing comment if: | - failure() && - steps.spellcheck.outputs.spell_failed == 'true' && - github.event_name == 'pull_request' + github.event_name == 'pull_request' && + steps.spellcheck.outputs.spell_failed == '1' uses: actions/github-script@v6 id: find-comment with: script: | + console.log('Checking for existing comments...'); const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, @@ -160,17 +159,18 @@ jobs: comment.user.type === 'Bot' && comment.body.includes('Spellcheck has failed') ); + console.log('Found existing comment:', botComment ? botComment.id : 'none'); return botComment ? botComment.id : ''; result-encoding: string - name: Post or update spell check comment if: | - failure() && - steps.spellcheck.outputs.spell_failed == 'true' && - github.event_name == 'pull_request' + github.event_name == 'pull_request' && + steps.spellcheck.outputs.spell_failed == '1' uses: actions/github-script@v6 with: script: | + console.log('Spell check log:', process.env.SPELL_LOG); const message = `Spellcheck has failed. Please review the log and address the issues. Here are a few tips: @@ -186,7 +186,10 @@ jobs: \`\`\``; const commentId = '${{ steps.find-comment.outputs.result }}'; + console.log('Comment ID:', commentId); + if (commentId) { + console.log('Updating existing comment'); await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -194,6 +197,7 @@ jobs: body: message }); } else { + console.log('Creating new comment'); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -202,4 +206,4 @@ jobs: }); } env: - SPELL_LOG: ${{ steps.spellcheck.outputs.spell_log }} + SPELL_LOG: ${{ steps.spellcheck.outputs.spell_log }} From 673a0cf0d970090450ab1f99f777e9c06c4465b2 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 15:45:21 -0800 Subject: [PATCH 24/27] Update spellcheck comment --- .github/workflows/spelling.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index e3dd1657f5d..9ba2220e3cb 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -136,6 +136,9 @@ jobs: echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT echo "SPELLEOF" >> $GITHUB_OUTPUT + echo "Debug: FINAL_EXIT_CODE=$FINAL_EXIT_CODE" + echo "Debug: spell_failed=true was set" + if [ $FINAL_EXIT_CODE -ne 0 ]; then echo "Spell check failed! See above for details." exit 1 @@ -144,7 +147,7 @@ jobs: - name: Check for existing comment if: | github.event_name == 'pull_request' && - steps.spellcheck.outputs.spell_failed == '1' + steps.spellcheck.outputs.spell_failed == 'true' uses: actions/github-script@v6 id: find-comment with: @@ -166,11 +169,13 @@ jobs: - name: Post or update spell check comment if: | github.event_name == 'pull_request' && - steps.spellcheck.outputs.spell_failed == '1' + steps.spellcheck.outputs.spell_failed == 'true' uses: actions/github-script@v6 with: script: | - console.log('Spell check log:', process.env.SPELL_LOG); + console.log('Debug: Attempting to post/update comment'); + console.log('Debug: spell_failed =', '${{ steps.spellcheck.outputs.spell_failed }}'); + const message = `Spellcheck has failed. Please review the log and address the issues. Here are a few tips: From 672cc57dd36702101489bc8140e390fb4636a030 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 22 Jan 2025 15:53:53 -0800 Subject: [PATCH 25/27] Update spellcheck comment --- .github/workflows/spelling.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 9ba2220e3cb..2e8e7e8d1d9 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -147,7 +147,7 @@ jobs: - name: Check for existing comment if: | github.event_name == 'pull_request' && - steps.spellcheck.outputs.spell_failed == 'true' + steps.spellcheck.outcome == 'failure' uses: actions/github-script@v6 id: find-comment with: @@ -169,7 +169,7 @@ jobs: - name: Post or update spell check comment if: | github.event_name == 'pull_request' && - steps.spellcheck.outputs.spell_failed == 'true' + steps.spellcheck.outcome == 'failure' uses: actions/github-script@v6 with: script: | From caa45fe68a9978cdeb10eeea870f15fe40d2f9f2 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 23 Jan 2025 10:24:56 -0800 Subject: [PATCH 26/27] Remove posting comment --- .github/workflows/spelling.yml | 80 +++++----------------------------- 1 file changed, 11 insertions(+), 69 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 2e8e7e8d1d9..bda339859f6 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -141,74 +141,16 @@ jobs: if [ $FINAL_EXIT_CODE -ne 0 ]; then echo "Spell check failed! See above for details." + echo + echo "Here are a few tips:" + echo "- All PyTorch API objects must be in double backticks or use an intersphinx directive." + echo " Example: ``torch.nn``, :func:`torch.load`" + echo "- Consult en-wordlist.txt for spellings of some of the words." + echo " You can add a word to en-wordlist.txt if:" + echo " 1) It's a common abbreviation, like RNN." + echo " 2) It's a word widely accepted in the industry." + echo "- Please do not add words like 'dtype', 'torch.nn.Transformer' to pass spellcheck." + echo " Instead wrap it in double backticks or use an intersphinx directive." + echo exit 1 fi - - - name: Check for existing comment - if: | - github.event_name == 'pull_request' && - steps.spellcheck.outcome == 'failure' - uses: actions/github-script@v6 - id: find-comment - with: - script: | - console.log('Checking for existing comments...'); - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - const botComment = comments.find(comment => - comment.user.type === 'Bot' && - comment.body.includes('Spellcheck has failed') - ); - console.log('Found existing comment:', botComment ? botComment.id : 'none'); - return botComment ? botComment.id : ''; - result-encoding: string - - - name: Post or update spell check comment - if: | - github.event_name == 'pull_request' && - steps.spellcheck.outcome == 'failure' - uses: actions/github-script@v6 - with: - script: | - console.log('Debug: Attempting to post/update comment'); - console.log('Debug: spell_failed =', '${{ steps.spellcheck.outputs.spell_failed }}'); - - const message = `Spellcheck has failed. Please review the log and address the issues. - - Here are a few tips: - - All PyTorch API objects must be in double backticks or use an intersphinx directive. Example: \`\`torch.nn\`\`, :func:\`torch.load\`. - - Consult en-wordlist.txt for spellings of some of the words. You can add a word to en-wordlist.txt if: - 1) It's a common abbreviation, like RNN. - 2) It's a word widely accepted in the industry. - - Please do not add words like \`dtype\`, \`torch.nn.Transformer\` to pass spellcheck. Instead wrap it in double backticks or use an intersphinx directive. - - Spell check log: - \`\`\` - ${process.env.SPELL_LOG} - \`\`\``; - - const commentId = '${{ steps.find-comment.outputs.result }}'; - console.log('Comment ID:', commentId); - - if (commentId) { - console.log('Updating existing comment'); - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: parseInt(commentId), - body: message - }); - } else { - console.log('Creating new comment'); - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: message - }); - } - env: - SPELL_LOG: ${{ steps.spellcheck.outputs.spell_log }} From 2654a34ffe6b7f78aef0256616456f51082cf0f2 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 23 Jan 2025 11:40:46 -0800 Subject: [PATCH 27/27] Update --- .github/workflows/spelling.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index bda339859f6..9556c8c3683 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -136,15 +136,12 @@ jobs: echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT echo "SPELLEOF" >> $GITHUB_OUTPUT - echo "Debug: FINAL_EXIT_CODE=$FINAL_EXIT_CODE" - echo "Debug: spell_failed=true was set" - if [ $FINAL_EXIT_CODE -ne 0 ]; then echo "Spell check failed! See above for details." echo echo "Here are a few tips:" echo "- All PyTorch API objects must be in double backticks or use an intersphinx directive." - echo " Example: ``torch.nn``, :func:`torch.load`" + echo " Example: ``torch.nn``, :func:" echo "- Consult en-wordlist.txt for spellings of some of the words." echo " You can add a word to en-wordlist.txt if:" echo " 1) It's a common abbreviation, like RNN."