-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add pre-commit hook for validating release notes #937
Conversation
f207c1d
to
5309f17
Compare
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.
Not against this, but personally I don't feel like installing pre-commit just for this repo.
How about we also add it to the existing make syntax-check
target?
I have made the changes to add the pre-commit hook to the make-syntax check. I think that is all would be needed. Please let me know if anything else needs to be changed. |
Makefile
Outdated
@@ -1,7 +1,8 @@ | |||
.PHONY: syntax-check | |||
.PHONY: syntax-check pre-commit-check print-rollouts |
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.
Hum, why is this adding pre-commit-check
here?
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.
based on the review comment earlier, I added the pre-commit check to the syntax check here.
@@ -0,0 +1,8 @@ | |||
repos: |
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's using this file?
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 yaml is used by the pre-commit tool framework for managing pre-commit hooks. Pre-commit hooks run automatically before a commit is finalized. It requires the installation of pre-commit tool in the local environment
Makefile
Outdated
syntax-check: pre-commit-check | ||
@find streams updates -iname '*.json' | sort | xargs -n 1 python3 -c 'import json, sys; json.load(open(sys.argv[1]))' | ||
pre-commit-check: | ||
pre-commit run --all-files |
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.
syntax-check: pre-commit-check | |
@find streams updates -iname '*.json' | sort | xargs -n 1 python3 -c 'import json, sys; json.load(open(sys.argv[1]))' | |
pre-commit-check: | |
pre-commit run --all-files | |
syntax-check: pre-commit-check | |
@find streams updates -iname '*.json' | sort | xargs -n 1 python3 -c 'import json, sys; json.load(open(sys.argv[1]))' | |
@find release-notes -iname '*.yaml' | sort | xargs -n1 python3 ci/check-release-notes.py |
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.
thanks for this input. I have made these changes.
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.
Since we now have it part of syntax-check
, it's already covered by the existing validate.yml
workflow, so we can get rid of the validate-release-notes.yml
file.
Coincidentally, it looks like validation is failing. :)
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.
Still need to drop GitHub workflow.
.pre-commit-config.yaml
Outdated
name: Validate Release Notes | ||
entry: python ci/check-release-notes.py | ||
language: python | ||
files: ^release-notes/.*\.yml$ |
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.
How about now we make this config use make syntax-check
? That way it'll check more than just release notes.
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.
Thanks! LGTM though let's squash to a single commit?
- This is a pre-commit hook using `pre-commit` framework to validate release notes YAML files. - The hook checks for correct structure, formatting and required fields in the `release-notes` directory. - This ensures consistency in release notes before committing changes. - Added release notes validation to the `make syntax-check` target Ref: coreos#934 (comment)
This is a pre-commit hook using
pre-commit
framework to validate release notes YAML files.release-notes
directory.Ref: