Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
deploy:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9.x'
python-version: "3.9.x"

- name: Install dependencies
run: |
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Run Local Tests
run: |
which scanoss-check-undeclared-code
scanoss-check-undeclared-code --version
scanoss-check-undeclared-code --help
scanoss-check-undeclared-code

- name: Dev Uninstall
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ jobs:
- name: Run Local Tests
run: |
which scanoss-check-undeclared-code
scanoss-check-undeclared-code --version
scanoss-check-undeclared-code --help
scanoss-check-undeclared-code
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ docs/build
!.devcontainer/*.example.json

.scanoss
.env
3 changes: 2 additions & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
language: python
stages: [pre-commit, pre-push, manual]
pass_filenames: false

require_serial: true
verbose: true
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Upcoming changes...

## [0.3.0] - 2025-10-24
### Added
- CLI arguments support: `--api-url`, `--api-key`, `--proxy`, `--pac`, `--ca-cert`, `--output`, `--debug`, `--ignore-cert-errors`, `--rest`
- Support for custom output path for scan results
- Improved logging with configurable debug mode
- Sensitive information sanitization in command logging
- Click library for enhanced CLI experience

### Changed
- Refactored from argparse to click for better CLI argument handling
- Consolidated utility functions into main module (removed utils.py)
- Enhanced error handling and user feedback
- Updated GitHub Actions workflows to use `--help` instead of `--version`

### Fixed
- Pre-commit hook behavior when committing files with no matches
- Release workflow improvements

## [0.2.0] - 2025-03-21
### Added
- Added version details
Expand All @@ -23,3 +41,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[0.1.0]: https://github.com/scanoss/pre-commit-hooks/compare/v0.0.1...v0.1.0
[0.2.0]: https://github.com/scanoss/pre-commit-hooks/compare/v0.1.0...v0.2.0
[0.3.0]: https://github.com/scanoss/pre-commit-hooks/compare/v0.2.0...v0.3.0
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [License](#license)
- [Bugs/Features](#bugsfeatures)
- [Contributing](#contributing)
- [Release and Deployment](#release-and-deployment)
- [Changelog](#changelog)

## Available Hooks
Expand Down Expand Up @@ -128,5 +129,53 @@ To request features or alert about bugs, please do so [here](https://github.com/
## Contributing
We welcome contributions to this project! Please clone the repository and submit a pull request with your changes. Ensure that your code passes all pre-commit checks before submitting.

## Release and Deployment

This project uses automated GitHub Actions workflows to manage releases. The package is distributed through GitHub Releases and the pre-commit framework (not PyPI).

### Release Process

1. **Update Version**: Modify `__version__` in `src/hooks/__init__.py` following semantic versioning (MAJOR.MINOR.PATCH)

2. **Create Tag**: Run the `tag-version.yml` workflow manually:
- Go to Actions → "Tag Version" → "Run workflow"
- The workflow compares the Python package version with the latest Git tag
- If versions differ, it creates and pushes a new tag (e.g., `v0.3.0`)

3. **Automated Release**: The `release.yml` workflow triggers automatically when a tag is pushed:
- Builds the package in a clean environment
- Runs verification tests (binary check, `--help`, basic execution)
- Creates a draft GitHub Release

4. **Publish Release**: A maintainer reviews and publishes the draft release manually

### Version Management

- **Current Version Source**: `src/hooks/__init__.py`
- **Versioning Strategy**: Semantic Versioning (SemVer)
- **Tag Format**: `v0.3.0` (with 'v' prefix)
- **Major Version Tags**: The repository maintains `v0` and `v1` tags that point to the latest patch release, allowing users to pin to a major version and automatically receive updates

### Distribution

Users reference this package in their `.pre-commit-config.yaml`:

```yaml
repos:
- repo: https://github.com/scanoss/pre-commit-hooks
rev: v0 # Pin to major version, or use v0.3.0 for specific version
hooks:
- id: scanoss-check-undeclared-code
```

The pre-commit framework installs directly from the Git repository—no PyPI publishing required.

### Key Workflows

- `.github/workflows/tag-version.yml` - Manual workflow for version tagging
- `.github/workflows/release.yml` - Automated draft release creation
- `.github/workflows/test.yml` - Continuous testing on main branch and PRs
- `.github/workflows/update-main-version.yml` - Major version tag maintenance

## Changelog
Details of major changes to the library can be found in [CHANGELOG.md](CHANGELOG.md).
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
scanoss>=1.20.5
rich>=13.9.3
rich>=13.9.3
click==8.1.8
6 changes: 2 additions & 4 deletions scanoss.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"settings": {
"skip": {
"patterns": {
"scanning": [
"src/hooks/__init__.py"
]
"scanning": ["src/hooks/__init__.py"]
},
"sizes": {}
}
Expand All @@ -24,4 +22,4 @@
}
]
}
}
}
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ python_requires = >=3.9
install_requires =
scanoss>=1.20.5
rich>=13.9.3
click==8.1.8

[options.packages.find]
where = src
Expand Down
25 changes: 24 additions & 1 deletion src/hooks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
"""
SPDX-License-Identifier: MIT

__version__ = '0.2.0'
Copyright (c) 2024, SCANOSS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

__version__ = "0.3.0"
Loading