Skip to content

Added the TPA/FCA notebook #118

Added the TPA/FCA notebook

Added the TPA/FCA notebook #118

name: "lint-notebooks"
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
permissions:
contents: read
pull-requests: write
jobs:
lint:
name: Run notebook linting and spell check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for changed-files action
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Run ruff format check
run: uvx ruff format --check --diff .
- name: Run ruff lint check
run: uvx ruff check .
- name: Get changed notebook files
id: changed_notebooks
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@v46
with:
files: |
**.ipynb
- name: Run spell check on changed notebooks
id: spellcheck
if: github.event_name == 'pull_request' && steps.changed_notebooks.outputs.any_changed == 'true'
continue-on-error: true
run: |
uvx python spellcheck.py ${{ steps.changed_notebooks.outputs.all_changed_files }} > spellcheck_output.txt || true
- name: Prepare spellcheck comment body
id: prepare_comment
if: >
github.event_name == 'pull_request' &&
steps.changed_notebooks.outputs.any_changed == 'true' &&
steps.spellcheck.outcome == 'success' &&
hashFiles('spellcheck_output.txt') != ''
run: |
echo "<!-- lint-notebooks-spellcheck-comment -->" > comment_body.txt
echo "" >> comment_body.txt
cat spellcheck_output.txt >> comment_body.txt
echo "Generated by GitHub Action run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> comment_body.txt
- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find_comment
if: steps.prepare_comment.outcome == 'success'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- lint-notebooks-spellcheck-comment -->'
- name: Post or Update spell check comment
if: steps.prepare_comment.outcome == 'success'
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
body-path: comment_body.txt
edit-mode: replace