Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#440): ✨ add precommit hook #439

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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