Fix: Disabling while in 'serve' mode after first run #2
Workflow file for this run
This file contains 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 | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- ready_for_review | |
- synchronize | |
- reopened | |
concurrency: | |
group: ${{ format('{0}-{1}-{2}-{3}-{4}', github.workflow, github.event_name, github.ref, github.base_ref, github.head_ref) }} | |
cancel-in-progress: true | |
jobs: | |
linter: | |
name: Linter | |
if: ${{ !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Detect changes | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
gh-workflows: | |
- '.github/workflows/**' | |
python: | |
- '**/*.py' | |
- 'poetry.lock' | |
- 'poetry.toml' | |
- 'pyproject.toml' | |
- 'tests/**' | |
changed: | |
- '**' | |
list-files: shell | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: poetry | |
- name: Install dependencies | |
run: poetry install --only=dev --verbose | |
- name: Cache pre-commit | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run pre-commit | |
run: poetry run pre-commit run --show-diff-on-failure --color always ${{ (github.event_name == 'pull_request' && format('--files {0}', steps.changes.outputs.changed_files)) || '--all-files' }} | |
env: | |
SKIP: ${{ (steps.changes.outputs.python != 'true' && 'no-commit-to-branch,pyupgrade,mypy,isort,black,flake8,bandit') || 'no-commit-to-branch' }} | |
- name: actionlint | |
if: ${{ steps.changes.outputs.gh-workflows == 'true' }} | |
uses: raven-actions/actionlint@v1 |