Skip to content

Commit ce17dcc

Browse files
committed
added github action for pre-commit
1 parent 65429ea commit ce17dcc

File tree

2 files changed

+41
-34
lines changed

2 files changed

+41
-34
lines changed

.github/workflows/config-validated.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Run pre-commit
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
# Declare default permissions as read only.
8+
permissions: read-all
9+
10+
jobs:
11+
pre-commit:
12+
runs-on: ubuntu-latest
13+
name: pre-commit
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
18+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
19+
with:
20+
python-version: 3.x
21+
22+
- name: Remove rh-pre-commit hook (requires VPN)
23+
uses: mikefarah/yq@8bf425b4d1344db7cd469a8d10a390876e0c77fd # v4.45.1
24+
with:
25+
cmd: yq -i 'del( .repos[] | select(.rev == "rh-pre-commit-*"))' .pre-commit-config.yaml
26+
27+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
28+
29+
- name: Check if there are changes
30+
id: changes
31+
run: |
32+
git checkout HEAD -- .pre-commit-config.yaml
33+
echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
34+
35+
- name: Fail if l changes found
36+
if: steps.changes.outputs.changed >= 1
37+
run: |
38+
echo "Uncommitted changes exist. Failing."
39+
echo
40+
git status --porcelain
41+
exit 1

0 commit comments

Comments
 (0)