-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add max-header-length for header length check #85
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,25 @@ | ||
| on: | ||
| push: | ||
| branches: ['main'] | ||
| branches: ["main"] | ||
|
|
||
| name: release-please | ||
|
|
||
| jobs: | ||
| release-please: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| # This job has the highest privileges, so always pin actions to a specific commit hash. | ||
| # Ensure the referenced commit hash is verified and free from known vulnerabilities. | ||
| id-token: write # for PYPI release | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Release | ||
| id: release | ||
| uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3 | ||
| uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| - uses: actions/checkout@v6 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (non-blocking): Lines 11-12 say "always pin actions to a specific commit hash," but this line and |
||
| if: ${{ steps.release.outputs.release_created }} | ||
|
|
||
| - name: tag major and minor versions | ||
|
|
@@ -32,10 +34,10 @@ jobs: | |
| git push origin v${{ steps.release.outputs.major }} -f | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| uses: actions/setup-python@v6 | ||
| if: ${{ steps.release.outputs.release_created }} | ||
| with: | ||
| python-version: '3.x' | ||
| python-version: "3.10" | ||
|
|
||
| - name: Install dependencies | ||
| if: ${{ steps.release.outputs.release_created }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,28 @@ def get_boolean_input(key: str) -> bool: | |
| ) | ||
|
|
||
|
|
||
| def get_int_input(key: str) -> int | None: | ||
| """ | ||
| Read the GitHub action integer input. | ||
|
|
||
| Args: | ||
| key: Input key. | ||
|
|
||
| Returns: | ||
| The integer value of the input. If not integer, returns None | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (non-blocking): Docstring says "If not integer, returns None" but the function raises Returns:
The integer value of the input, or None if the value is an empty string.
Raises:
ValueError: If the value is a non-empty, non-integer string. |
||
| """ | ||
| val = get_input(key) | ||
|
|
||
| if val == "": | ||
| # GitHub Action passes empty data as a empty string ("") | ||
| return None | ||
|
|
||
| try: | ||
| return int(val) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (non-blocking): The CLI validates Consider adding a positive-integer check: result = int(val)
if result <= 0:
raise ValueError(f"Input '{key}' must be a positive integer (> 0).")
return result |
||
| except ValueError: | ||
| raise ValueError(f"Input '{key}' must be a valid integer.") from None | ||
|
|
||
|
|
||
| def write_line_to_file(filepath: str, line: str) -> None: | ||
| """ | ||
| Write line to a specified filepath. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| """Module for AppParams""" | ||
|
|
||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass | ||
| class AppParams: | ||
| """ | ||
| Represents runtime parameters that control linting behavior and output handling. | ||
|
|
||
| These parameters are typically derived from CLI arguments and define how | ||
| commit messages are validated and displayed. | ||
| """ | ||
|
|
||
| # Skips the detailed error check (fails immediately without detail error message). | ||
| skip_detail: bool = False | ||
|
|
||
| # Hide input from stdout/stderr. Specially used by Github Actions. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (non-blocking): "Specially" → "Specifically" and "Github" → "GitHub" (capital H, matching the project's naming elsewhere). |
||
| hide_input: bool = False | ||
|
|
||
| # Maximum header length to check. If not specified, the header length is not checked. | ||
| max_header_length: int | None = None | ||
|
|
||
| # Remove comments from the commit message. | ||
| strip_comments: bool = False | ||
Uh oh!
There was an error while loading. Please reload this page.