Skip to content

Commit 8a01181

Browse files
committed
Compare minor version number
This deals with the case that we skip `x.y.0` and go straight to `x.y.1`.
1 parent 80e1425 commit 8a01181

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.github/workflows/update-bundle.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,21 @@ jobs:
5757
- name: Update bundle
5858
uses: ./.github/actions/update-bundle
5959

60-
- name: Bump action minor version for new CodeQL minor version series
60+
- name: Bump Action minor version if new CodeQL minor version series
6161
id: bump-action-version
6262
run: |
63+
prior_cli_version=$(jq -r '.priorCliVersion' src/defaults.json)
6364
cli_version=$(jq -r '.cliVersion' src/defaults.json)
64-
# Check if this is a new minor version series (patch version is 0)
65-
if [[ "$cli_version" =~ ^[0-9]+\.[0-9]+\.0$ ]]; then
66-
echo "New CodeQL minor version series detected ($cli_version), bumping action minor version"
65+
66+
prior_minor=$(echo "$prior_cli_version" | cut -d. -f2)
67+
current_minor=$(echo "$cli_version" | cut -d. -f2)
68+
69+
if [[ "$current_minor" != "$prior_minor" ]]; then
70+
echo "New CodeQL minor version series ($prior_cli_version -> $cli_version), bumping Action minor version"
6771
npm version minor --no-git-tag-version
6872
echo "bumped=true" >> "$GITHUB_OUTPUT"
6973
else
70-
echo "Not a new minor version series ($cli_version), skipping action version bump"
74+
echo "Same minor version series ($prior_cli_version -> $cli_version), skipping Action version bump"
7175
echo "bumped=false" >> "$GITHUB_OUTPUT"
7276
fi
7377
@@ -92,9 +96,7 @@ jobs:
9296
9397
pr_body="This pull request updates the default CodeQL bundle, as used with \`tools: linked\` and on GHES, to $cli_version."
9498
if [[ "$ACTION_VERSION_BUMPED" == "true" ]]; then
95-
pr_body="$pr_body
96-
97-
Since this is a new CodeQL minor version series, this PR also bumps the Action version to $action_version."
99+
pr_body+=$'\n\n'"Since this is a new CodeQL minor version series, this PR also bumps the Action version to $action_version."
98100
fi
99101
100102
pr_url=$(gh pr create \

0 commit comments

Comments
 (0)