-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (34 loc) · 1.15 KB
/
code_quality_checks.yml
File metadata and controls
40 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# workflow to validate code formatting using pre-commit hooks
name: Code Quality Check
permissions:
contents: read
on:
- pull_request
- workflow_dispatch
jobs:
pre-commit:
runs-on: [ self-hosted ]
container: python:3.9
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for pre-commit to work
# python:3.9 image has no git; pre-commit requires it.
- name: Install git
run: |
apt-get update
apt-get install -y --no-install-recommends git
- name: Configure git for container
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global user.email "ci@github.com"
git config --global user.name "CI Bot"
- name: setup environment and run pre-commit hooks
shell: bash
run: |
source ./dev-setup.sh
pre-commit run --all-files --show-diff-on-failure --color=always
- name: Print message on failure
if: failure()
run: |
echo "### :x: Pre-commit hooks failed. Please check logs for changes needed" >> $GITHUB_STEP_SUMMARY