From 5b207fd0daa4d5ca19bfdca5888db3a9765862ec Mon Sep 17 00:00:00 2001 From: trevor-anderson Date: Sun, 9 Jul 2023 11:05:31 -0400 Subject: [PATCH] feat(ci): add 'no-commit-to-branch' hook to forbid pushing to main --- .pre-commit-config.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8b7aecb5..5be30690 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,22 +1,23 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: # Git Style - - id: check-added-large-files # Prevent large files from commit (default=500kb) + - id: check-added-large-files # prevent large files from commit (default=500kb) - id: check-merge-conflict - id: check-vcs-permalinks - id: forbid-new-submodules - # TODO Upon deploying into production, add "no-commit-to-branch" to protect "main". + - id: no-commit-to-branch # main branch can only be updated via PR + args: [--branch, main] # Common Errors - id: check-executables-have-shebangs - - id: check-yaml # Validate yaml file syntax - - id: end-of-file-fixer # Ensure files end in newline char - exclude: src/(graphql/__codegen__/.*|.*\.snap)$ # Don't modify Jest snapshots nor codegen-made files + - id: check-yaml # validate yaml file syntax + - id: end-of-file-fixer # ensure files end in newline char + exclude: src/(graphql/__codegen__/.*|.*\.snap)$ # don't modify Jest snapshots nor codegen'd files exclude_types: [graphql, svg, json] - - id: trailing-whitespace # Trim superfluous whitespace from eol - exclude: src/(types/graphql/.*|.*\.snap)$ # Don't modify Jest snapshots nor codegen-made files + - id: trailing-whitespace # trim superfluous whitespace from eol + exclude: src/(types/graphql/.*|.*\.snap)$ # don't modify Jest snapshots nor codegen'd files exclude_types: [graphql] args: [--markdown-linebreak-ext=md]