From f4024beaebaab5a989cdbed07f5d4e657e22d369 Mon Sep 17 00:00:00 2001 From: adssib <75389300+adssib@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:13:15 -0500 Subject: [PATCH 1/2] release: also run on its own twice a week when something new was merged Co-Authored-By: Claude Opus 5.5 Signed-off-by: adssib <75389300+adssib@users.noreply.github.com> --- .github/workflows/release.yml | 29 +++++++++++++++++++++++++---- AGENTS.md | 2 +- CONTRIBUTING.md | 8 ++++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 044d5ab..96609bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,9 @@ # Release: tag main's HEAD with the next version and publish a GitHub release. # -# A maintainer runs it by hand: Actions -> Release -> Run workflow -> pick the bump. -# It never runs on push, on a schedule or on a PR. +# It runs on its own twice a week (Monday and Thursday, 14:00 UTC) as a patch release, +# and only when something was merged since the last tag; otherwise it does nothing. +# A maintainer can also run it by hand any time (Actions -> Release -> Run workflow -> +# pick the bump), e.g. for an urgent fix or a minor release. It never runs on push or on a PR. # # patch v0.4.1 -> v0.4.2 fixes, new providers on an existing format plugin # minor v0.4.1 -> v0.5.0 new format plugins, new exported API, anything a user should read about @@ -19,6 +21,8 @@ name: Release on: + schedule: + - cron: "0 14 * * 1,4" # Mon + Thu 14:00 UTC; scheduled runs are always a patch release workflow_dispatch: inputs: bump: @@ -64,11 +68,17 @@ jobs: - name: next version id: version env: - BUMP: ${{ inputs.bump }} + BUMP: ${{ inputs.bump || 'patch' }} + EVENT: ${{ github.event_name }} run: | head=$(git rev-parse HEAD) existing=$(git tag --points-at "$head") if [ -n "$existing" ]; then + if [ "$EVENT" = "schedule" ]; then + echo "Nothing merged since $existing: no release this time." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi echo "::error::main's HEAD ($head) is already tagged: $existing. Nothing new to release." exit 1 fi @@ -94,9 +104,11 @@ jobs: echo "sha=$head" >> "$GITHUB_OUTPUT" - name: internal names (hashed), whole tree + if: steps.version.outputs.skip != 'true' run: python3 scripts/leak_guard.py --all - name: install gitleaks ${{ env.GITLEAKS_VERSION }} + if: steps.version.outputs.skip != 'true' run: | tarball="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" curl -fsSL -o "$RUNNER_TEMP/$tarball" "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/${tarball}" @@ -104,20 +116,25 @@ jobs: tar -xzf "$RUNNER_TEMP/$tarball" -C "$RUNNER_TEMP" gitleaks - name: gitleaks, whole history + if: steps.version.outputs.skip != 'true' run: '"$RUNNER_TEMP/gitleaks" git --no-banner --redact --verbose .' - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + if: steps.version.outputs.skip != 'true' with: go-version-file: go.mod cache-dependency-path: go.sum - name: go build + if: steps.version.outputs.skip != 'true' run: go build ./... - name: go vet + if: steps.version.outputs.skip != 'true' run: go vet ./... - name: gofmt + if: steps.version.outputs.skip != 'true' run: | unformatted=$(gofmt -l .) if [ -n "$unformatted" ]; then @@ -125,21 +142,25 @@ jobs: fi - name: go test + if: steps.version.outputs.skip != 'true' run: go test -race -count=1 ./... # Only reached when every check above passed. - name: create and push the annotated tag + if: steps.version.outputs.skip != 'true' env: TAG: ${{ steps.version.outputs.tag }} SHA: ${{ steps.version.outputs.sha }} ACTOR: ${{ github.actor }} + EVENT_NAME: ${{ github.event_name }} run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -a "$TAG" "$SHA" -m "$TAG" -m "Released by @$ACTOR with the Release workflow." + git tag -a "$TAG" "$SHA" -m "$TAG" -m "Released by the Release workflow ($EVENT_NAME, @$ACTOR)." git push origin "refs/tags/$TAG" - name: publish the GitHub release + if: steps.version.outputs.skip != 'true' env: GH_TOKEN: ${{ github.token }} TAG: ${{ steps.version.outputs.tag }} diff --git a/AGENTS.md b/AGENTS.md index 1876402..c47c831 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -75,4 +75,4 @@ The [change-event contract](https://github.com/patch-it-dev/patch-it/tree/main/d ## Releases -Agents never tag or release. A maintainer runs the **Release** workflow (see [CONTRIBUTING.md](CONTRIBUTING.md#releasing)). Never delete or move a tag. +Agents never tag or release. The **Release** workflow tags a patch release on its own every Monday and Thursday when something new was merged, and a maintainer can run it by hand (see [CONTRIBUTING.md](CONTRIBUTING.md#releasing)). Never delete or move a tag. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44ff553..2fa0fbd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,11 +38,15 @@ That adds `Signed-off-by: Your Name `, matching the commit's au | `CI_dco` | Every commit in the PR is signed off by its author | | `CI_leak_guard` | gitleaks over the PR's commits, and a check for known internal names (stored as hashes only). Also runs weekly over the whole repo | | `Claude Code Review` | Claude reviews the PR against the rules above, once (PRs from this repo's branches; forks: a maintainer comments `@claude review`). Advisory, not a required check | -| `Release` | Not a check: a maintainer runs it by hand to tag a release (see [Releasing](#releasing)) | +| `Release` | Not a check: tags a release on its own twice a week, or when a maintainer runs it (see [Releasing](#releasing)) | ## Releasing -Releases are tags on `main` (`v0.x.y`), made only by the **Release** workflow, which a maintainer runs by hand. Nothing is tagged on push, and agents never tag or release. +Releases are tags on `main` (`v0.x.y`), made only by the **Release** workflow. Nothing is tagged on push, and agents never tag or release. + +**Automatic, twice a week:** every Monday and Thursday at 14:00 UTC the workflow makes a **patch** release, but only if something was merged since the last tag; otherwise it does nothing. So a merged plugin reaches patch-it's hosted ingestion service within a few days. + +**By hand, any time** (an urgent fix, or a **minor** release): 1. Merge the PRs that should go out. 2. **Actions → Release → Run workflow** (branch `main`), pick the bump: From f78a5c0dcb8cf2dcf097fe081f42db847a7a5c10 Mon Sep 17 00:00:00 2001 From: adssib <75389300+adssib@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:26:22 -0500 Subject: [PATCH 2/2] release: skip scheduled runs that add a format plugin; fix all.go import order The scheduled run now skips with a warning when a new plugins// directory appeared since the last tag (that's a minor, cut by hand), and scheduled tags no longer credit whoever last edited the workflow. plugins/all/all.go had catalog before apichangelog (gofmt), which failed CI_go on main since the redis merge. Co-Authored-By: Claude Opus 5.5 Signed-off-by: adssib <75389300+adssib@users.noreply.github.com> --- .github/workflows/release.yml | 15 ++++++++++++++- CONTRIBUTING.md | 2 +- plugins/all/all.go | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96609bf..8e1d14c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,6 +99,17 @@ jobs: echo "::error::$next already exists." exit 1 fi + # A new format plugin (a new plugins// directory) deserves a minor, not a + # patch. A scheduled run can't decide that, so it skips and a maintainer releases by hand. + if [ "$EVENT" = "schedule" ] && [ -n "$latest" ]; then + new_formats=$(comm -13 <(git ls-tree -d --name-only "$latest" plugins/ | sort) <(git ls-tree -d --name-only HEAD plugins/ | sort)) + if [ -n "$new_formats" ]; then + echo "::warning::New format plugin(s) since $latest: $new_formats. That's a minor release: run Release by hand with bump=minor." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + fi + echo "latest=${latest:-none}, bump=$BUMP -> $next at $head" echo "tag=$next" >> "$GITHUB_OUTPUT" echo "sha=$head" >> "$GITHUB_OUTPUT" @@ -156,7 +167,9 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -a "$TAG" "$SHA" -m "$TAG" -m "Released by the Release workflow ($EVENT_NAME, @$ACTOR)." + by="scheduled" + [ "$EVENT_NAME" = "workflow_dispatch" ] && by="run by @$ACTOR" + git tag -a "$TAG" "$SHA" -m "$TAG" -m "Released by the Release workflow ($by)." git push origin "refs/tags/$TAG" - name: publish the GitHub release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2fa0fbd..8d8c30a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ That adds `Signed-off-by: Your Name `, matching the commit's au Releases are tags on `main` (`v0.x.y`), made only by the **Release** workflow. Nothing is tagged on push, and agents never tag or release. -**Automatic, twice a week:** every Monday and Thursday at 14:00 UTC the workflow makes a **patch** release, but only if something was merged since the last tag; otherwise it does nothing. So a merged plugin reaches patch-it's hosted ingestion service within a few days. +**Automatic, twice a week:** every Monday and Thursday at 14:00 UTC the workflow makes a **patch** release, but only if something was merged since the last tag; otherwise it does nothing. If the merges add a **new format plugin** (a new `plugins//` directory), the scheduled run skips with a warning instead: run it by hand with **minor**. So a merged plugin reaches patch-it's hosted ingestion service within a few days. **By hand, any time** (an urgent fix, or a **minor** release): diff --git a/plugins/all/all.go b/plugins/all/all.go index 68867eb..e8bd0bd 100644 --- a/plugins/all/all.go +++ b/plugins/all/all.go @@ -4,8 +4,8 @@ package all import ( - _ "github.com/patch-it-dev/patch-it-plugins/plugins/catalog" _ "github.com/patch-it-dev/patch-it-plugins/plugins/apichangelog" + _ "github.com/patch-it-dev/patch-it-plugins/plugins/catalog" _ "github.com/patch-it-dev/patch-it-plugins/plugins/changelog" _ "github.com/patch-it-dev/patch-it-plugins/plugins/feed" _ "github.com/patch-it-dev/patch-it-plugins/plugins/migrationguide"