-
Notifications
You must be signed in to change notification settings - Fork 31
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
Check for conventional commits in CI #338
base: main
Are you sure you want to change the base?
Conversation
https://github.com/juspay/services-flake/actions/runs/11004484171/job/30555489649?pr=338 Tested for failure, force pushing now to pass CI |
4635e56
to
785539c
Compare
default_branch=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5) | ||
|
||
# Get the latest commit on the default branch | ||
# rev range using the `default_branch` branch name (e.g. main..HEAD), doesn't work in Github Actions | ||
latest_default_commit=$(git rev-parse origin/"$default_branch") | ||
|
||
current_commit=$(git rev-parse HEAD) | ||
|
||
if [ "$latest_default_commit" = "$current_commit" ]; then | ||
echo "No commits to check between $default_branch and HEAD." | ||
else | ||
cz check --rev-range "$latest_default_commit"..HEAD | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation isn’t generic enough, i.e, it always assumes that the current branch is going to be merged to main
, which is okay for now. We can re-think this later if we have a complicated branch tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$GITHUB_BASE_REF
?
785539c
to
7992a63
Compare
@@ -32,6 +33,32 @@ | |||
nixpkgs-fmt.enable = true; | |||
}; | |||
}; | |||
|
|||
# TODO: Move this under `CIApps` once `omnix` supports running them automatically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is CIApps
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Custom flake-schema that can be detected by omnix to run everything under it as custom app steps.
default_branch=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5) | ||
|
||
# Get the latest commit on the default branch | ||
# rev range using the `default_branch` branch name (e.g. main..HEAD), doesn't work in Github Actions | ||
latest_default_commit=$(git rev-parse origin/"$default_branch") | ||
|
||
current_commit=$(git rev-parse HEAD) | ||
|
||
if [ "$latest_default_commit" = "$current_commit" ]; then | ||
echo "No commits to check between $default_branch and HEAD." | ||
else | ||
cz check --rev-range "$latest_default_commit"..HEAD | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$GITHUB_BASE_REF
?
resolves #130