Skip to content

Check the version increment only for PRs into default branches#686

Merged
alexander-yevsyukov merged 2 commits into
masterfrom
claude/modest-thompson-0aqffs
Jun 10, 2026
Merged

Check the version increment only for PRs into default branches#686
alexander-yevsyukov merged 2 commits into
masterfrom
claude/modest-thompson-0aqffs

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Problem

The Version Guard workflow — and, by cascade, JUnit Test Report (push) — failed for PRs whose base branch is not the default one (master). The guard triggered on push to any branch and enabled checkVersionIncrement for any branch not ending with master/main, with no awareness of where the branch intends to merge. Since checkVersionIncrement is wired into check, the Ubuntu CI build failed before tests produced reports, taking the JUnit report check down with it (require_tests: true).

A version increment is the responsibility of a branch which aims to merge into a default (or otherwise protected) branch. Auxiliary branches do not deal with the versions in the release cycle.

Changes

  • IncrementGuard now enables the checkVersionIncrement task only for pull_request events whose base branch name ends with master or main (covers master, main, and release-line branches such as 2.x-jdk8-master). The push-event logic and the GITHUB_REF parsing are gone; the decision is a pure function covered by the new IncrementGuardTest.
  • Version Guard workflow triggers on pull_request instead of push to all branches. The base branch is checked by a job-level if mirroring the IncrementGuard logic: for a PR into an auxiliary branch the job reports skipped, which satisfies required status checks (a workflow skipped via the branches filter would leave a required check in the Pending state, blocking the PR) and occupies no runner.
  • License Reports workflow gets the same job-level gate: the dependency report files embed the project version, so they are refreshed by the version-bumping branches. PRs into auxiliary branches no longer require touching them. (ensure-reports-updated.sh itself needs no change — it already works off GITHUB_BASE_REF.)

Behavioral notes

  • The guard now fires on PR events (opened/synchronize) rather than on pushes, so a branch without an open PR is never version-checked. Coverage for master-bound work is unchanged: every push to a PR'd branch triggers synchronize.
  • Pushes no longer fail Ubuntu CI/JUnit Test Report over a stale version. Instead, for PRs into master-like bases, the enabled task participates in check on Windows CI (a pull_request build) alongside the dedicated Version Guard run — the same signal, moved from push-side to PR-side.
  • Required status check configurations keep working: the job names are unchanged, and skipped jobs satisfy them.

Verification

  • ./gradlew -p buildSrc test — passes, including the new IncrementGuardTest.
  • ./gradlew detekt — passes.
  • Both workflow files parse as valid YAML with the expected pull_request triggers and job conditions.

Consumer repositories receive the fix via the usual ./config/pull cycle.

https://claude.ai/code/session_01Et5WtRbSBtjL6ZiXynsDfr

A version increment is required only from a branch which aims to merge
into a default (`master`/`main`) or a release-line (e.g. `2.x-jdk8-master`)
branch. Auxiliary branches do not deal with the versions in the release
cycle, so pull requests targeting them must not be version-guarded.

 - `IncrementGuard` now enables the `checkVersionIncrement` task only for
   `pull_request` events whose base branch name ends with `master` or
   `main`, instead of `push` events to any feature branch. This also stops
   the `build` task (and hence the JUnit test report) from failing on
   pushes when the version is not yet bumped.
 - The `Version Guard` workflow is triggered by `pull_request` events
   filtered by the base branches above, instead of `push` to any branch.
 - The `License Reports` workflow is filtered the same way: the report
   files embed the project version, so only version-bumping branches
   refresh them.

https://claude.ai/code/session_01Et5WtRbSBtjL6ZiXynsDfr

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6011f232de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github-workflows/increment-guard.yml Outdated
Comment thread .github-workflows/ensure-reports-updated.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the version-increment enforcement to run only for pull requests targeting default/release-line branches (those ending in master/main), preventing auxiliary-branch PRs and plain pushes from failing CI due to version-guard logic.

Changes:

  • Update IncrementGuard to enable checkVersionIncrement only for pull_request events with a base branch ending in master/main, using GITHUB_BASE_REF.
  • Change the “Version Guard” and “License Reports” workflows to trigger only on pull_request events targeting **master / **main.
  • Add unit tests covering the new IncrementGuard decision logic.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
buildSrc/src/test/kotlin/io/spine/gradle/publish/IncrementGuardTest.kt Adds coverage for the new “check only PRs into default/release-line branches” decision function.
buildSrc/src/main/kotlin/io/spine/gradle/publish/IncrementGuard.kt Switches the guard decision from push/ref parsing to a pure PR+base-branch check using GITHUB_BASE_REF.
.github-workflows/increment-guard.yml Moves Version Guard to pull_request and filters to default/release-line target branches only.
.github-workflows/ensure-reports-updated.yml Applies the same pull_request base-branch filtering to the license report update check.
.agents/tasks/version-guard-aux-base-branches.md Records the rationale/plan for the change so it’s traceable for future maintenance.

A workflow skipped because of the `branches` filter leaves its check in
the `Pending` state. In a repository where `Version Guard` or `License
Reports` is configured as a required status check beyond the default
branch, this would block PRs into auxiliary branches instead of waiving
them.

A job skipped via an `if` condition reports the `skipped` conclusion,
which satisfies required status checks, and does not occupy a runner.
So the workflows now trigger on all `pull_request` events, and the base
branch is checked by the job-level `if` mirroring the `IncrementGuard`
logic.

https://claude.ai/code/session_01Et5WtRbSBtjL6ZiXynsDfr
@alexander-yevsyukov alexander-yevsyukov merged commit 028459f into master Jun 10, 2026
2 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the claude/modest-thompson-0aqffs branch June 10, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants