GitHub actions tutorial #18
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: Linter - Quality and Type Checks | |
| on: | |
| - push | |
| - pull_request | |
| - workflow_dispatch | |
| jobs: | |
| lint: # The name of the job | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Changed Python files only | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| files: "**/*.py" | |
| - name: List all changed files | |
| env: | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| run: | | |
| for file in ${ALL_CHANGED_FILES}; do | |
| echo "$file was changed" | |
| done | |
| #Set up Python | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| #Ruff linter for checking. Replaces manual install and run. | |
| - uses: astral-sh/ruff-action@v3 | |
| if: ${{ steps.changed-files.outputs.all_changed_files }} | |
| with: | |
| src: >- | |
| ${{ steps.changed-files.outputs.all_changed_files }} |