Skip to content

Commit

Permalink
feat(hooks): added precommit hook (#439)
Browse files Browse the repository at this point in the history
Co-authored-by: andy Augustin <AndreasAugustin@users.noreply.github.com>
  • Loading branch information
xontab and AndreasAugustin authored Jan 18, 2024
1 parent f9f0907 commit 4a42410
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ The following hooks are supported (please check [docs/ARCHITECTURE.md](docs/ARCH

* `install` is executed after the container has started and after reading and setting up the environment.
* `prepull` is executed before the code is pulled from the source repository
* `precommit` is executed before the code is commited
* `prepush` is executed before the push is executed, right after the commit
* `prepr` is executed before the PR is done

Expand All @@ -320,6 +321,10 @@ hooks:
commands:
- echo 'hi, we are within the prepull phase'
- echo 'maybe you want to do adjustments on the local code'
precommit:
commands:
- echo 'hi, we are within the precommit phase'
- echo 'maybe you want to add further changes before the code is committed'
prepush:
commands:
- echo 'hi, we are within the prepush phase'
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GitCommitSync["fa:fa-code-commit Commit the changes"]
CheckIsDryRun{"Check if is_dry_run is set to true"}
GitPushSync["Push the changes to GitHub"]
GitPullRequestSync["fa:fa-code-pull-request Create a pull request on GitHub"]
Hook{{"hooks, <b>prepush | prepush | prepr</b>"}}
Hook{{"hooks, <b>prepull | precommit | prepush | prepr</b>"}}
subgraph githubactions["fa:fa-github GitHubActions"]
Expand Down
2 changes: 2 additions & 0 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ if [ -s "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]; then
echo "::endgroup::"
fi

cmd_from_yml_file "precommit"

echo "::group::commit changes"
git add .

Expand Down

0 comments on commit 4a42410

Please sign in to comment.