Skip to content

Commit

Permalink
#571 Use pre-commit dog food and update release process for pre-commi…
Browse files Browse the repository at this point in the history
…t autoupdate. (#572)

* Use pre-commit dog food.

* Run pre-commit autoupdate.

* Update .github/workflows/ci.yml

* Better name. Also run auto-update.

* Add news fragment.

* Update black.

* Update pre-commit hooks.

* Use latets towncrier.

* Use latest pre-commit-hooks.

* Use immutable versions

* Add info about release process.

* Apply fix from Sadik.

* Update .github/workflows/ci.yml

Co-authored-by: Chris Beaven <[email protected]>

---------

Co-authored-by: Hynek Schlawack <[email protected]>
Co-authored-by: Chris Beaven <[email protected]>
  • Loading branch information
3 people authored May 21, 2024
1 parent 272993f commit 2bde077
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,36 @@ jobs:
if: ${{ matrix.task.run-if }}


pre-commit:
name: Check pre-commit integration
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: python -m pip install pre-commit

- name: Install pre-commit
run: |
pre-commit install
- name: Update pre-commit
run: |
pre-commit autoupdate
- name: Run pre-commit
run: |
pre-commit run -a
pypi-publish:
name: Check tag and publish
# Only trigger this for tag changes.
Expand Down Expand Up @@ -292,6 +322,7 @@ jobs:
- test-windows
- coverage
- check
- pre-commit
steps:
- name: Require all successes
uses: re-actors/alls-green@3a2de129f0713010a71314c74e33c0e3ef90e696
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ repos:
- id: debug-statements
- id: check-toml
- id: check-yaml

- repo: https://github.com/twisted/towncrier
rev: 23.11.0
hooks:
- id: towncrier-check
9 changes: 8 additions & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ In ``src/towncrier/_version.py`` the version is set using ``incremental`` such a

Commit and push the changes.

Merge the commit in the main branch.
Merge the commit in the main branch, **without using squash**.

We tag the release based on a commit from the release branch.
If we merge with squash,
the release tag commit will no longer be found in the main branch history.
With a squash merge, the whole branch history is lost.
This causes the `pre-commit autoupdate` to fail.
See `PR590 <https://github.com/twisted/towncrier/pull/590>`_ for more details.

You can announce the release over IRC or Gitter.

Expand Down
4 changes: 2 additions & 2 deletions docs/pre-commit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Usage with the default configuration
repos:
- repo: https://github.com/twisted/towncrier
rev: 22.13.0 # run 'pre-commit autoupdate' to update
rev: 23.11.0 # run 'pre-commit autoupdate' to update
hooks:
- id: towncrier-check
Expand All @@ -30,7 +30,7 @@ News fragments are stored in ``changelog.d/`` in the root of the repository and
repos:
- repo: https://github.com/twisted/towncrier
rev: 22.13.0 # run 'pre-commit autoupdate' to update
rev: 23.11.0 # run 'pre-commit autoupdate' to update
hooks:
- id: towncrier-update
files: $changelog\.d/
Expand Down
Empty file.

0 comments on commit 2bde077

Please sign in to comment.