Skip to content

Commit

Permalink
pre-commit prevent commits to protected branches (#16970)
Browse files Browse the repository at this point in the history
To help ensure NV Access admins do not accidentally commit and push to master, we can add a pre-commit check to protect branches from local commits.
This would also aid other developers in preventing local commits to branches they cannot/shouldn't push to in their own forks accidentally, if they wish to contribute upstream.

Description of user facing changes
Add pre-commit hook which fails when trying to commit to a protected branch

Description of development approach
Add pre-commit hook which fails when trying to commit to a protected branch
  • Loading branch information
seanbudd authored Aug 7, 2024
1 parent b4c8693 commit 2751974
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ ci:
autofix_commit_msg: "Pre-commit auto-fix"

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# Prevents commits to certain branches
- id: no-commit-to-branch
args: ["--branch", "master", "--branch", "beta", "--branch", "rc"]
# Checks python syntax
- id: check-ast
# File uses encoding not supported in Linux
Expand Down

0 comments on commit 2751974

Please sign in to comment.