Skip to content

Commit

Permalink
Merge pull request stanfordnlp#282 from stanfordnlp/OPS/ops_activatin…
Browse files Browse the repository at this point in the history
…g_pre_commit_hook

ops(dspy): activating pre-commit global check (and aligning to py3.9)
  • Loading branch information
okhat authored Jan 22, 2024
2 parents 7aa6ca4 + d4fa535 commit 6ce78cd
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/precommits_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Pre-commit checks
on:
pull_request:
branches:
- dev
- main
types:
- opened
- edited
- synchronize
workflow_dispatch:
branches:
- dev
- main

jobs:
pre-commit-checks:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
- name: Check Pull Request Title
uses: Slashgear/action-check-pr-title@main
with:
regexp: '(break|build|ci|docs|feat|fix|perf|refactor|style|test|ops|hotfix|release|maint|init|enh|revert)\([a-z,A-Z,0-9,\-,\_,\/,:]+\)(:)\s{1}([\w\s]+)' # Regex the title should match.
- name: Getting changed files list
id: files
uses: jitterbit/get-changed-files@master
- name: Checking changed files
shell: bash
run: |
echo "Changed files"
echo ${{ steps.files.outputs.all }}
echo "Github Client version"
echo $(gh --version)
- name: Pre-Commit Checks
run: |
python -m pip install --upgrade pip
pip install pre-commit
echo "Running pre-commit scans:"
# adding log display in case of pre-commit errors
pre-commit run -v --files ${{ steps.files.outputs.all }}
shell: bash
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.11
python: python3.9

default_stages: [commit]
default_install_hook_types: [pre-commit, commit-msg]
Expand All @@ -22,7 +22,7 @@ repos:
args:
[
"--profile=black",
"--py=311",
"--py=39",
"--line-length=120",
"--multi-line=3",
"--trailing-comma",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ exclude_lines = [
[tool.ruff]
line-length = 120
indent-width = 4
target-version = "py311"
target-version = "py39"
extend-unsafe-fixes = ["D"]

[tool.ruff.lint]
Expand Down

0 comments on commit 6ce78cd

Please sign in to comment.