-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #800 from kevin1024/pre-commit-ci
Start using pre-commit in CI
- Loading branch information
Showing
13 changed files
with
128 additions
and
52 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (c) 2023 Sebastian Pipping <[email protected]> | ||
# Licensed under the MIT license | ||
|
||
name: Detect outdated pre-commit hooks | ||
|
||
on: | ||
schedule: | ||
- cron: '0 16 * * 5' # Every Friday 4pm | ||
|
||
# NOTE: This will drop all permissions from GITHUB_TOKEN except metadata read, | ||
# and then (re)add the ones listed below: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
pre_commit_detect_outdated: | ||
name: Detect outdated pre-commit hooks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install pre-commit | ||
run: |- | ||
pip install \ | ||
--disable-pip-version-check \ | ||
--no-warn-script-location \ | ||
--user \ | ||
pre-commit | ||
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}" | ||
- name: Check for outdated hooks | ||
run: |- | ||
pre-commit autoupdate | ||
git diff -- .pre-commit-config.yaml | ||
- name: Create pull request from changes (if any) | ||
id: create-pull-request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
author: 'pre-commit <[email protected]>' | ||
base: master | ||
body: |- | ||
For your consideration. | ||
:warning: Please **CLOSE AND RE-OPEN** this pull request so that [further workflow runs get triggered](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) for this pull request. | ||
branch: precommit-autoupdate | ||
commit-message: "pre-commit: Autoupdate" | ||
delete-branch: true | ||
draft: true | ||
labels: enhancement | ||
title: "pre-commit: Autoupdate" | ||
|
||
- name: Log pull request URL | ||
if: "${{ steps.create-pull-request.outputs.pull-request-url }}" | ||
run: | | ||
echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2023 Sebastian Pipping <[email protected]> | ||
# Licensed under the MIT license | ||
|
||
name: Run pre-commit | ||
|
||
on: | ||
- pull_request | ||
- push | ||
- workflow_dispatch | ||
|
||
jobs: | ||
pre-commit: | ||
name: Run pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
- uses: pre-commit/[email protected] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2023 Sebastian Pipping <[email protected]> | ||
# Licensed under the MIT license | ||
|
||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.7 | ||
hooks: | ||
- id: ruff | ||
args: ["--show-source"] | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# https://blog.ionelmc.ro/2015/04/14/tox-tricks-and-patterns/#when-it-inevitably-leads-to-shell-scripts | ||
# If you are getting an INVOCATION ERROR for this script then there is | ||
# If you are getting an INVOCATION ERROR for this script then there is | ||
# a good chance you are running on Windows. | ||
# You can and should use WSL for running tox on Windows when it calls bash scripts. | ||
REQUESTS_CA_BUNDLE=`python3 -m pytest_httpbin.certs` exec pytest "$@" |
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
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
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
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