diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug-report.yml similarity index 97% rename from .github/ISSUE_TEMPLATE/bug.yml rename to .github/ISSUE_TEMPLATE/bug-report.yml index a9e720b..9c89022 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,5 +1,6 @@ name: Bug report description: something went wrong +labels: ["bug"] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..375a8f2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +# Documentation for this file can be found at: +# https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository + +blank_issues_enabled: false +contact_links: + - name: "(maintainers only) Blank issue" + url: https://github.com/commit-check/commit-check/issues/new/ + about: For maintainers only. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..6f24ab5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,38 @@ +name: Feature request +description: Suggest an idea for this project +labels: ["enhancement"] + +body: + - type: markdown + attributes: + value: >- + Hi there! + + We'd appreciate it if you could search on commit-check's existing issues prior to filing + a feature request. + + - type: textarea + attributes: + label: What's the problem this feature will solve? + description: >- + What are you trying to do, that you are unable to achieve with commit-check as it currently stands? + validations: + required: true + + - type: textarea + attributes: + label: Describe the solution you'd like + description: >- + Clear and concise description of what you want to happen. Please use examples + of real world use cases that this would help with, and how it solves the + problem described above. + validations: + required: true + + - type: textarea + attributes: + label: Additional context + description: >- + Add any other context, links, etc. relevant to the feature request. + validations: + required: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4efa956..8199536 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - py: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + py: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-beta.1'] os: ['windows-latest', 'ubuntu-latest', 'macos-latest'] runs-on: ${{ matrix.os }} steps: @@ -102,7 +102,7 @@ jobs: - name: Upload docs to github pages # only publish doc changes from main branch if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/_build/html diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 2fec59e..f104e16 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -6,6 +6,10 @@ on: types: [published] workflow_dispatch: +permissions: + id-token: write + attestations: write + jobs: publish: runs-on: ubuntu-latest @@ -30,6 +34,11 @@ jobs: # Check distribution twine check dist/commit_check* + - name: Create attestations + uses: actions/attest-build-provenance@v1 + with: + subject-path: "dist/commit_check*" + - name: Generate subject id: hash run: | @@ -59,7 +68,7 @@ jobs: id-token: write # To sign the provenance. contents: write # To add assets to a release. # Can't pin with hash due to how this workflow works. - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0 + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0 with: base64-subjects: ${{ needs.publish.outputs.hashes }} upload-assets: true # Optional: Upload to a new release diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 7c8d6e7..d25c13e 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,21 +1,11 @@ -# https://github.com/release-drafter/release-drafter name: Release Drafter on: push: branches: - "main" - pull_request: - types: [opened, reopened, synchronize] - pull_request_target: - types: [opened, reopened, synchronize] workflow_dispatch: jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # Drafts your next Release notes as Pull Requests are merged into the default branch - - uses: release-drafter/release-drafter@v6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + draft-release: + uses: commit-check/.github/.github/workflows/release-drafter.yml@main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ffa800e..467425b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: default_install_hook_types: [pre-commit, prepare-commit-msg] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-yaml - id: check-toml @@ -22,17 +22,17 @@ repos: args: [--max-line-length=100, --ignore=E501] exclude: ^commit_check/__init__.py - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy additional_dependencies: [types-all] exclude: ^testing/resources/ - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell - repo: https://github.com/commit-check/commit-check - rev: v0.7.3 + rev: v0.7.4 hooks: - id: check-message # - id: check-branch # uncomment if you need. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92cd278..b2b7160 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,9 +9,36 @@ Our development branch is `main`. When submitting pull requests, please adhere t * Add tests for any new features and bug fixes. * Put a reasonable amount of comments into the code. * Fork [commit-check](https://github.com/commit-check/commit-check) on your GitHub user account. -* Create branch from `main`, make your changes on the new branch and then create a PR against `main` branch of commit-check repository. +* Create a branch from `main`, make your changes on the new branch, and then create a PR against the `main` branch of the commit-check repository. * Separate unrelated changes into multiple pull requests for better review and management. By contributing any code or documentation to this repository (by raising pull requests or otherwise), you explicitly agree to the [License Agreement](https://github.com/commit-check/commit-check/blob/main/LICENSE). We appreciate your contributions to make Commit Check even better! + +## Development + +### Debug commit-check pre-commit hook + +```bash +pre-commit try-repo ./../commit-check/ check-message --verbose --hook-stage prepare-commit-msg --commit-msg-filename .git/COMMIT_EDITMSG +``` + +### Debug commit-check wheel package + +```bash +python3 -m pip install --upgrade pip +pip install -e ./../commit-check/ +commit-check -m +``` + +### Test commit-check pre-commit hook on GitHub + +```yaml +- repo: https://github.com/commit-check/commit-check + rev: the tag or revision # update it to test commit hash + hooks: + - id: check-message + - id: check-branch + - id: check-author-email +```