diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 10e740e..435d98f 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -2,6 +2,10 @@ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" + labels: + - dependencies + - github_actions + - skip news schedule: interval: "weekly" day: "tuesday" diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index e4f019f..173e65f 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -5,6 +5,7 @@ on: branches: ["main"] tags-ignore: ["**"] pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] schedule: - cron: "0 8 * * *" @@ -53,3 +54,34 @@ jobs: run: tox run --skip-pkg-install -e ${{ matrix.env }} env: PYTEST_ADDOPTS: "-vv --durations=5" + + changelog: + if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip news') + runs-on: ubuntu-26.04 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 + with: + python-version: "3.15" + enable-cache: false + - run: uvx towncrier check --compare-with "origin/${GITHUB_BASE_REF}" + + gate: + name: Required checks pass + if: always() + needs: [test, changelog] + runs-on: ubuntu-26.04 + steps: + - env: + NEEDS_JSON: ${{ toJSON(needs) }} + run: | + jq -e ' + all( + to_entries[]; + .value.result == "success" or + (.key == "changelog" and .value.result == "skipped") + ) + ' <<< "$NEEDS_JSON" diff --git a/.github/workflows/prepare-release.yaml b/.github/workflows/prepare-release.yaml new file mode 100644 index 0000000..cfb8738 --- /dev/null +++ b/.github/workflows/prepare-release.yaml @@ -0,0 +1,106 @@ +name: Prepare release +on: + workflow_dispatch: + inputs: + version: + description: Version to release, without a v prefix + required: true +permissions: {} +concurrency: + group: prepare-release + cancel-in-progress: false +jobs: + assemble: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-26.04 + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 + with: + python-version: "3.15" + enable-cache: false + - name: Build release patch + env: + VERSION: ${{ inputs.version }} + run: | + set -euo pipefail + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::expected a major.minor.patch version" + exit 1 + fi + latest=$(git tag --list '[0-9]*' | sort -V | tail -n 1) + if [[ "$(printf '%s\n' "$latest" "$VERSION" | sort -V | tail -n 1)" != "$VERSION" || "$latest" == "$VERSION" ]]; then + echo "::error::$VERSION must be newer than $latest" + exit 1 + fi + if ! compgen -G 'changelog.d/*.md' > /dev/null; then + echo "::error::no changelog fragments to release" + exit 1 + fi + uvx towncrier build --yes --version "$VERSION" + git diff HEAD --binary > "$RUNNER_TEMP/release.patch" + test -s "$RUNNER_TEMP/release.patch" + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: release-patch + path: ${{ runner.temp }}/release.patch + if-no-files-found: error + push: + needs: assemble + runs-on: ubuntu-26.04 + environment: release-auth + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: release-patch + path: ${{ runner.temp }}/release-patch + - name: Validate release patch + env: + VERSION: ${{ inputs.version }} + run: | + set -euo pipefail + git fetch origin main + git reset --hard origin/main + git apply --check "$RUNNER_TEMP/release-patch/release.patch" + git apply --index "$RUNNER_TEMP/release-patch/release.patch" + while IFS= read -r path; do + case "$path" in + CHANGELOG.md|changelog.d/*.md) ;; + *) echo "::error::unexpected release path: $path"; exit 1 ;; + esac + done < <(git diff --cached --name-only) + grep -Fq "## $VERSION (" CHANGELOG.md + git diff --cached --check + - id: token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.RELEASE_APP_CLIENT_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: ${{ github.event.repository.name }} + permission-contents: write + - name: Commit and tag the release + env: + VERSION: ${{ inputs.version }} + GH_TOKEN: ${{ steps.token.outputs.token }} + APP_SLUG: ${{ steps.token.outputs.app-slug }} + run: | + set -euo pipefail + app_user_id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id) + git config user.name "${APP_SLUG}[bot]" + git config user.email "${app_user_id}+${APP_SLUG}[bot]@users.noreply.github.com" + git commit -m "chore: prepare $VERSION" + git tag "$VERSION" + gh auth setup-git --hostname github.com --force + git push --atomic origin HEAD:main "refs/tags/$VERSION" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 66306f6..b397394 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,6 +17,18 @@ jobs: with: fetch-depth: 0 persist-credentials: false + - name: Require a changelog section for the tag + env: + TAG: ${{ github.ref_name }} + run: | + if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::unexpected release tag $TAG" + exit 1 + fi + if ! grep -qF "## $TAG (" CHANGELOG.md; then + echo "::error::CHANGELOG.md has no section for $TAG" + exit 1 + fi - name: Install the latest version of uv uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 with: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..91c42d3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,151 @@ +# Changelog + + + +## 4.4.0 (2026-10-10) + +### What's Changed + +- 🔧 chore: batch dependency updates weekly on Tuesday by @gaborbernat in + https://github.com/tox-dev/pre-commit-uv/pull/172 +- 👷 ci: pin ubuntu-26.04 and bump dependencies by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/181 +- feat(python): require 3.11 and default to 3.15 by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/183 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.3.0...4.4.0 + +## 4.3.0 (2026-07-20) + +No user-facing changes. This tag includes Python 3.15 CI coverage and dependency updates. + +## 4.2.2 (2026-06-19) + +### What's Changed + +- 🔧 chore(tox): migrate tox.ini to tox.toml by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/116 +- Migrate type checking from mypy to ty by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/117 +- Move from extras to dependency-groups by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/118 +- Align dependency versions across projects by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/120 +- Add permissions to workflows by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/121 +- Move SECURITY.md to .github/SECURITY.md by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/122 +- Add missing .github config files by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/123 +- Standardize .github files to .yaml suffix by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/126 +- 🔒 ci(workflows): add zizmor security auditing by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/131 +- Drop redundant int cast in \_new_main by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/148 +- Tolerate uv truncated pyvenv.cfg version_info by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/153 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.2.1...4.2.2 + +## 4.2.1 (2026-02-18) + +### What's Changed + +- 🐛 fix(venv): seed pip into hook environments by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/114 +- 🐛 fix(patch): detect python -m pre_commit by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/115 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.2.0...4.2.1 + +## 4.2.0 (2025-10-09) + +### What's Changed + +- fix: add support for python 3.14 by @ssbarnea in https://github.com/tox-dev/pre-commit-uv/pull/86 +- Drop 3.9 support by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/91 + +### New Contributors + +- @ssbarnea made their first contribution in https://github.com/tox-dev/pre-commit-uv/pull/86 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.1.5...4.2.0 + +## 4.1.5 (2025-08-27) + +### What's Changed + +- Use current project config for uv by @aaravind100 in https://github.com/tox-dev/pre-commit-uv/pull/79 + +### New Contributors + +- @aaravind100 made their first contribution in https://github.com/tox-dev/pre-commit-uv/pull/79 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.1.4...4.1.5 + +## 4.1.4 (2024-10-29) + +### What's Changed + +- Respect UV_PYTHON and fallback to sys.executable by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/29 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.1.3...4.1.4 + +## 4.1.3 (2024-09-23) + +### What's Changed + +- Patch pre-commit also when called due to a git commit by @florianfischer91 in + https://github.com/tox-dev/pre-commit-uv/pull/18 + +### New Contributors + +- @florianfischer91 made their first contribution in https://github.com/tox-dev/pre-commit-uv/pull/18 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.1.2...4.1.3 + +## 4.1.2 (2024-09-18) + +### What's Changed + +- Improve the CI by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/16 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.1.1...4.1.2 + +## 4.1.1 (2024-09-08) + +### What's Changed + +- Declare 3.13 support by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/12 + +### New Contributors + +- @dependabot made their first contribution in https://github.com/tox-dev/pre-commit-uv/pull/10 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.1.0...4.1.1 + +## 4.1.0 (2024-08-12) + +### What's Changed + +- Specify pre-commit-uv and uv version in --version by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/7 + +### New Contributors + +- @pre-commit-ci made their first contribution in https://github.com/tox-dev/pre-commit-uv/pull/6 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.0.3...4.1.0 + +## 4.0.3 (2024-08-08) + +### What's Changed + +- Ensure uv knows caller Python by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/5 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.0.2...4.0.3 + +## 4.0.2 (2024-08-07) + +Add installation instructions. + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.0.1...4.0.2 + +## 4.0.1 (2024-08-07) + +### What's Changed + +- Avoid patching import overheads and extend README by @gaborbernat in https://github.com/tox-dev/pre-commit-uv/pull/2 + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/compare/4.0.0...4.0.1 + +## 4.0.0 (2024-08-05) + +- First version (using `4.0.0` as version to not break previous fork release of `3.8`). + +**Full Changelog**: https://github.com/tox-dev/pre-commit-uv/commits/4.0.0 diff --git a/README.md b/README.md index 7f7d378..0b4d525 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Use `uv` to create virtual environments and install packages for `pre-commit`. +[Changelog](CHANGELOG.md) + ## Installation With pipx: diff --git a/changelog.d/.gitkeep b/changelog.d/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index 866977d..23620a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ ] urls."Bug Tracker" = "https://github.com/tox-dev/pre-commit-uv/issues" urls."Source Code" = "https://github.com/tox-dev/pre-commit-uv" -urls.Changelog = "https://github.com/tox-dev/pre-commit-uv/releases" +urls.Changelog = "https://github.com/tox-dev/pre-commit-uv/blob/main/CHANGELOG.md" urls.Documentation = "https://github.com/tox-dev/pre-commit-uv/" [dependency-groups] @@ -149,3 +149,14 @@ paths.source = [ report.fail_under = 63 html.show_contexts = true html.skip_covered = false + +[tool.towncrier] +name = "pre-commit-uv" +directory = "changelog.d" +filename = "CHANGELOG.md" +title_format = "## {version} ({project_date})" +type = [ + { directory = "feature", name = "Features", showcontent = true }, + { directory = "bugfix", name = "Bug fixes", showcontent = true }, + { directory = "doc", name = "Documentation", showcontent = true }, +]