ci: Allow pre-commit to autofix files #372
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: Lint | ||
on: [push, pull_request] | ||
env: | ||
BASEDIR: https://raw.githubusercontent.com/open-contracting/standard-maintenance-scripts/main | ||
jobs: | ||
build: | ||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: pip | ||
cache-dependency-path: '**/requirements*.txt' | ||
- id: changed-files | ||
uses: tj-actions/changed-files@v39 | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: pip-compile --files ${{ steps.changed-files.outputs.all_changed_files }} | ||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: [github-actions] pre-commit autoupdate | ||
- shell: bash | ||
run: curl -s -S --retry 3 $BASEDIR/tests/install.sh | bash - | ||
- shell: bash | ||
run: curl -s -S --retry 3 $BASEDIR/tests/script.sh | bash - | ||
- run: pip install -r requirements_dev.txt | ||
- env: | ||
# libcoveocds is optional (try-except block). | ||
# https://github.com/OpenDataServices/lib-cove/pull/123 | ||
STANDARD_MAINTENANCE_SCRIPTS_IGNORE: libcove,libcoveocds | ||
STANDARD_MAINTENANCE_SCRIPTS_FILES: requirements_nongpl.in | ||
run: pytest /tmp/test_requirements.py |