Skip to content

Commit 27e5a3b

Browse files
authored
Add pre-commit guards to prevent agent shortcuts (#1)
* feat: add pre-commit guards to prevent agent shortcuts * ci: add pull_request trigger to run checks on PRs Add pull_request trigger to buildah.yml so that pre-commit checks and build verification run on pull requests. Push to registry is now conditional and only runs on push to main branch.
1 parent 181f41f commit 27e5a3b

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

.github/workflows/buildah.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
paths:
99
- '*/**'
1010
- '!.github/**'
11+
pull_request:
12+
paths:
13+
- '*/**'
14+
- '!.github/**'
1115
workflow_dispatch:
1216
inputs:
1317
image:
@@ -85,6 +89,7 @@ jobs:
8589
extra-args: --squash
8690

8791
- name: Push to registry
92+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
8893
uses: redhat-actions/push-to-registry@v2
8994
with:
9095
image: ${{ matrix.image }}

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ repos:
1010
- id: detect-private-key
1111
- id: mixed-line-ending
1212
- id: trailing-whitespace
13+
- id: no-commit-to-branch
14+
args: ['--branch', 'main']
15+
- id: check-added-large-files
16+
args: ['--maxkb=1000']
1317
- repo: https://github.com/hadolint/hadolint
1418
rev: v2.14.0
1519
hooks:

tfroot-runner/pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ repos:
4747
exclude: README.md
4848
- id: mixed-line-ending
4949
- id: trailing-whitespace
50+
- id: no-commit-to-branch
51+
args: ['--branch', 'main']
52+
- id: check-added-large-files
53+
args: ['--maxkb=1000']

0 commit comments

Comments
 (0)