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
23 changes: 22 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
echo "Run 'just sync-readme' to fix."
exit 1
}
grep -qx "## $VERSION" CHANGELOG.md || {
echo "CHANGELOG.md has no '## $VERSION' section"
exit 1
}

tag-release:
runs-on: ubuntu-latest
Expand All @@ -54,15 +58,32 @@ jobs:
steps:
- uses: actions/checkout@v6
- name: Tag version from pyproject.toml
run: |-
id: tag
run: |
VERSION=$(grep '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
TAG="v$VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null; then
echo "Tag $TAG already exists, skipping"
echo "created=false" >> "$GITHUB_OUTPUT"
else
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git tag "$TAG"
git push origin "$TAG"
echo "Tagged $TAG"
echo "created=true" >> "$GITHUB_OUTPUT"
fi
# Release notes are the CHANGELOG.md section for this version, from its
# heading up to the next heading.
- name: Publish GitHub release
if: steps.tag.outputs.created == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.tag.outputs.version }}
TAG: ${{ steps.tag.outputs.tag }}
run: |-
awk -v v="$VERSION" '$0 == "## " v {p=1; next} /^## /{p=0} p' CHANGELOG.md > notes.md
test -s notes.md || { echo "CHANGELOG.md has no '## $VERSION' section"; exit 1; }
gh release create "$TAG" --title "$TAG" --notes-file notes.md
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Changelog

All notable changes to this project are documented in this file.
Releases follow semantic versioning as described in [DEVELOPING.md](./DEVELOPING.md).

## 2.6.0

New hooks for Go and the web stack.
Minor bump: new checks, no removals, and existing hooks keep their behavior.

### Added

- `polymath-go`: formats Go with gofumpt and goimports, lints with golangci-lint's standard set plus errorlint, misspell, revive, and unconvert, and checks that staged `go.mod` and `go.sum` are tidy.
Requires Go 1.23 or newer on `PATH`.
golangci-lint is downloaded on first use into the hook's own virtualenv, verified against pinned checksums.
- `polymath-javascript`: runs ESLint with `--fix` and then Prettier on JavaScript, JSX, TypeScript, and TSX.
The rule set is `eslint:recommended`, typescript-eslint recommended, and React, React Hooks, and jsx-a11y rules for JSX/TSX files, with Prettier defaults for formatting.
Next.js and Storybook rules are opt-in via `--framework next` and `--framework storybook`.
- `polymath-css`: runs Stylelint with `--fix` and then Prettier on CSS and SCSS, using `stylelint-config-standard` and `stylelint-config-standard-scss`.
- `polymath-html`: formats HTML with Prettier.
- `polymath-copyright` inserts and validates `//` style headers in Go, JavaScript, JSX, TypeScript, and TSX files.

### Changed

- Node.js is bundled as a Python dependency.
The npm packages for the web hooks are installed once per hook revision on first use, and only when a web hook runs.
- Prettier ignores a consuming repo's `.editorconfig` and honors its `.gitignore` and `.prettierignore`.
- Checker configuration files live beside each checker in per-checker subpackages.

### Fixed

- The release tagging job no longer fails the workflow on merges that do not bump the version.
- `--relicense` on the copyright hook preserves Go `//go:build` and `// +build` directives.

### Upgrading

Add the new hook ids to `.pre-commit-config.yaml` as needed.
Repos using `polymath-copyright` with Go or web files will get headers inserted on the first run.
Stage the results and commit again.

## 2.5.0 and earlier

See the [GitHub releases](https://github.com/polymathrobotics/polymath_code_standard/releases).
6 changes: 4 additions & 2 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ To bump the version, use `just bump` -- it updates `pyproject.toml` and syncs th
just bump minor # or major / patch
```

CI will fail on PRs where the two are out of sync.
The tag is pushed automatically by CI on merge to main.
Then add a `## <version>` section to `CHANGELOG.md` describing the release.

CI fails PRs where the README pin or the changelog section is missing for the version in `pyproject.toml`.
On merge to main, CI pushes the tag and publishes a GitHub release whose notes are that changelog section.

## Testing

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Use only the hooks that apply to your project.
---
repos:
- repo: https://github.com/polymathrobotics/polymath_code_standard
rev: v2.5.0
rev: v2.6.0
hooks:
# File hygiene for all staged files
- id: polymath-general
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "polymath-code-standard"
version = "2.5.0"
version = "2.6.0"
description = "Polymath Code Standard pre-commit hooks"
requires-python = ">=3.10"
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading