Merge pull request #47 from GannettDigital/dbe3763_fix_known_issues #172
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: formatter | ||
|
Check failure on line 1 in .github/workflows/formatter.yml
|
||
| on: | ||
| pull_request: | ||
| branches: [ master ] | ||
| workflow_dispatch: | ||
| jobs: | ||
| linter_name: | ||
| name: runner / ruff | ||
| runs-on: [ubuntu-latest] | ||
| steps: | ||
| - name: Checkout PR head | ||
| uses: actions/checkout@v3 | ||
| if: github.event_name == 'pull_request' | ||
| with: | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
| if: github.event_name == 'workflow_dispatch' | ||
| - name: Get changed files | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v46.0.1 | ||
| with: | ||
| files: | | ||
| **/*.py | ||
| # This is used for forked PRs as write permissions are required to format files | ||
| - name: Run and commit changes with `ruff format .` locally on your forked branch to fix errors if they appear | ||
| if: ${{ github.event.pull_request.head.repo.fork == true and steps.changed-files.outputs.all_changed_files != '' }} | ||
| uses: chartboost/ruff-action@v1 | ||
| id: ruff_formatter_suggestions | ||
| with: | ||
| args: format --diff --target-version py38 | ||
| src: "${{ steps.changed-files.outputs.all_changed_files }}" | ||
| # This only runs if the PR is NOT from a forked repo | ||
| - name: Format files using ruff | ||
| if: ${{ github.event.pull_request.head.repo.fork == false }} | ||
| uses: chartboost/ruff-action@v1 | ||
| id: ruff_formatter | ||
| with: | ||
| args: format | ||
| # This only runs if the PR is NOT from a forked repo | ||
| #- name: Auto commit ruff formatting | ||
| # if: ${{ github.event.pull_request.head.repo.fork == false }} | ||
| # uses: stefanzweifel/git-auto-commit-action@v5 | ||
| # with: | ||
| # commit_message: 'style fixes by ruff' | ||