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

Check for conventional commits in CI #338

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

shivaraj-bh
Copy link
Member

@shivaraj-bh shivaraj-bh commented Sep 23, 2024

resolves #130

@shivaraj-bh
Copy link
Member Author

https://github.com/juspay/services-flake/actions/runs/11004484171/job/30555489649?pr=338

image

Tested for failure, force pushing now to pass CI

Comment on lines +45 to +58
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
Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -32,6 +33,32 @@
nixpkgs-fmt.enable = true;
};
};

# TODO: Move this under `CIApps` once `omnix` supports running them automatically
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is CIApps?

Copy link
Member Author

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.

Comment on lines +45 to +58
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conventional Commits pre-commit check is not working
2 participants