Skip to content

Commit 0252b4e

Browse files
Copilotswissspidy
andauthored
Fix: Only update branch alias on major releases (#225)
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 304a0aa commit 0252b4e

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

.github/workflows/reusable-check-branch-alias.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,23 @@ jobs:
6464
VERSION="${VERSION%%+*}"
6565
6666
# Parse major, minor, and patch versions
67-
IFS='.' read -r MAJOR MINOR _ <<< "$VERSION"
67+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
6868
69-
# Validate that MAJOR and MINOR are numeric
70-
if ! [[ "$MAJOR" =~ ^[0-9]+$ ]] || ! [[ "$MINOR" =~ ^[0-9]+$ ]]; then
69+
# Validate that MAJOR, MINOR, and PATCH are numeric
70+
if ! [[ "$MAJOR" =~ ^[0-9]+$ ]] || ! [[ "$MINOR" =~ ^[0-9]+$ ]] || ! [[ "$PATCH" =~ ^[0-9]+$ ]]; then
7171
echo "Invalid version format: $VERSION"
7272
echo "needs_update=false" >> "$GITHUB_OUTPUT"
7373
exit 0
7474
fi
7575
76-
# Calculate next minor version
77-
NEXT_MINOR=$((MINOR + 1))
78-
EXPECTED_ALIAS="${MAJOR}.${NEXT_MINOR}.x-dev"
76+
# Only update branch alias for major releases (minor and patch releases should keep the existing alias)
77+
if [ "$MINOR" != "0" ] || [ "$PATCH" != "0" ]; then
78+
echo "Not a major release (v${MAJOR}.0.0), skipping branch-alias update"
79+
echo "needs_update=false" >> "$GITHUB_OUTPUT"
80+
exit 0
81+
fi
82+
83+
EXPECTED_ALIAS="${MAJOR}.x-dev"
7984
8085
echo "Expected branch-alias: $EXPECTED_ALIAS"
8186
@@ -137,7 +142,7 @@ jobs:
137142
- Previous branch-alias: `${{ steps.check_alias.outputs.current_alias }}`
138143
- Updated branch-alias: `${{ steps.check_alias.outputs.expected_alias }}`
139144
140-
The branch-alias should point to the next minor development version after the latest release.
145+
The branch-alias should point to the major development version for the latest major release.
141146
branch: update-branch-alias
142147
delete-branch: true
143148
labels: |

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ This repository contains reusable GitHub Actions workflows that are automaticall
2323

2424
The branch alias checker workflow automatically ensures that the Composer `branch-alias` in each repository's `composer.json` is up-to-date. It:
2525

26-
1. Runs weekly (every Monday at 2 AM UTC) or can be triggered manually
26+
1. Runs on every release or can be triggered manually
2727
2. Checks the latest release tag
28-
3. Calculates the expected branch-alias (next minor version after the latest release)
29-
4. Compares with the current branch-alias
28+
3. On a new major release (`vX.0.0`), updates the branch-alias to `X.x-dev`
29+
4. Skips minor and patch releases, as the branch-alias should remain unchanged
3030
5. Creates a pull request if an update is needed
3131

32-
For example, if a repository has released version `2.12.0`, the branch-alias should be set to `2.13.x-dev` to point to the next development version.
32+
For example, if a repository releases `v2.2.6` or `v2.3.0`, the branch-alias stays at `2.x-dev`. Only when releasing `v3.0.0` should it change to `3.x-dev`.
3333

3434
## Installing
3535

0 commit comments

Comments
 (0)