Skip to content

Commit e7d2e71

Browse files
Copilotmbaluda
authored andcommitted
Remove static .codeql-version; derive it from qlt.conf.json at runtime in copilot-setup-steps workflow
Agent-Logs-Url: https://github.com/advanced-security/codeql-sap-js/sessions/baa532ae-dce3-46f4-8f65-9200ae19135c Co-authored-by: mbaluda <5237080+mbaluda@users.noreply.github.com>
1 parent 70f89a3 commit e7d2e71

File tree

3 files changed

+12
-49
lines changed

3 files changed

+12
-49
lines changed

.codeql-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/copilot-setup-steps.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
# Automatically run the setup steps when an associated workflow is changed.
55
push:
66
paths:
7-
- '.codeql-version'
7+
- 'qlt.conf.json'
88
- '.github/workflows/copilot-setup-steps.yml'
99
- '.node-version'
1010
- '**/codeql-pack.yml'
@@ -14,7 +14,7 @@ on:
1414
- 'extractors/cds/tools/package-lock.json'
1515
pull_request:
1616
paths:
17-
- '.codeql-version'
17+
- 'qlt.conf.json'
1818
- '.github/workflows/copilot-setup-steps.yml'
1919
- '.node-version'
2020
- '**/codeql-pack.yml'
@@ -45,6 +45,12 @@ jobs:
4545
working-directory: extractors/cds/tools
4646
run: npm ci
4747

48+
- name: Copilot Setup - Generate .codeql-version from qlt.conf.json
49+
run: |
50+
CODEQL_VERSION=$(jq -r '.CodeQLCLI' qlt.conf.json)
51+
printf 'v%s\n' "${CODEQL_VERSION}" > .codeql-version
52+
echo "Generated .codeql-version: $(cat .codeql-version)"
53+
4854
- name: Copilot Setup - Setup CodeQL environment
4955
uses: advanced-security/codeql-development-mcp-server/.github/actions/setup-codeql-environment@main
5056
with:

scripts/update-release-version.sh

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ set -euo pipefail
2727
## that reference other packs in this repository (e.g., ^X.Y.Z constraints).
2828
## - qlt.conf.json (CodeQLCLI, CodeQLStandardLibrary, CodeQLCLIBundle)
2929
## using the base version (X.Y.Z) derived by stripping any pre-release suffix.
30-
## - .codeql-version (vX.Y.Z, kept in sync with qlt.conf.json CodeQLCLI)
3130
##
3231
## Usage:
3332
## ./scripts/update-release-version.sh <new-version>
@@ -183,24 +182,8 @@ check_versions() {
183182
fi
184183
fi
185184

186-
## Also check .codeql-version consistency (must match qlt.conf.json CodeQLCLI with v prefix)
187-
local codeql_version_file="${REPO_ROOT}/.codeql-version"
188-
if [[ -f "${codeql_version_file}" ]]; then
189-
local codeql_file_version
190-
codeql_file_version=$(tr -d '[:space:]' < "${codeql_version_file}")
191-
local check_base="${expected_version:-${first_version}}"
192-
check_base="${check_base%%-*}"
193-
local expected_codeql_version="v${check_base}"
194-
if [[ "${codeql_file_version}" == "${expected_codeql_version}" ]]; then
195-
echo " ✅ .codeql-version: ${codeql_file_version}"
196-
else
197-
echo " ❌ .codeql-version: ${codeql_file_version} (expected ${expected_codeql_version})"
198-
all_consistent=false
199-
fi
200-
fi
201-
202185
echo ""
203-
echo "Checked ${file_count} version-bearing files + qlt.conf.json + .codeql-version."
186+
echo "Checked ${file_count} version-bearing files + qlt.conf.json."
204187

205188
if [[ "${all_consistent}" == true ]]; then
206189
if [[ -n "${expected_version}" ]]; then
@@ -274,30 +257,6 @@ update_qlt_config() {
274257
echo " ✅ qlt.conf.json: CodeQLCLI -> ${base_version}"
275258
}
276259

277-
## Update .codeql-version file (kept in sync with qlt.conf.json CodeQLCLI)
278-
## The file contains the version with a 'v' prefix, e.g. v2.25.0
279-
update_codeql_version_file() {
280-
local new_version="$1"
281-
local dry_run="${2:-false}"
282-
local codeql_version_file="${REPO_ROOT}/.codeql-version"
283-
284-
# Derive the base version by stripping any pre-release suffix
285-
local base_version="${new_version%%-*}"
286-
287-
if [[ ! -f "${codeql_version_file}" ]]; then
288-
echo "WARNING: .codeql-version not found, skipping" >&2
289-
return 0
290-
fi
291-
292-
if [[ "${dry_run}" == true ]]; then
293-
echo " [DRY RUN] .codeql-version: -> v${base_version}"
294-
return 0
295-
fi
296-
297-
printf 'v%s\n' "${base_version}" > "${codeql_version_file}"
298-
echo " ✅ .codeql-version: -> v${base_version}"
299-
}
300-
301260
## Update internal dependency references in a qlpack.yml file
302261
## e.g., advanced-security/javascript-sap-cap-models: "^2.3.0" -> "^2.4.0"
303262
## e.g., advanced-security/javascript-sap-cap-models: "^2.3.0" -> "^2.4.0-alpha"
@@ -368,15 +327,14 @@ update_versions() {
368327
fi
369328
done
370329

371-
## Update qlt.conf.json and .codeql-version
330+
## Update qlt.conf.json
372331
update_qlt_config "${new_version}" "${dry_run}"
373-
update_codeql_version_file "${new_version}" "${dry_run}"
374332

375333
echo ""
376334
if [[ "${dry_run}" == true ]]; then
377-
echo "Would update ${updated_count} qlpack files + qlt.conf.json + .codeql-version. (Dry run — no files modified)"
335+
echo "Would update ${updated_count} qlpack files + qlt.conf.json. (Dry run — no files modified)"
378336
else
379-
echo "Updated ${updated_count} qlpack files + qlt.conf.json + .codeql-version to version ${new_version}."
337+
echo "Updated ${updated_count} qlpack files + qlt.conf.json to version ${new_version}."
380338
echo ""
381339
echo "Next steps:"
382340
echo " 1. Run 'codeql pack upgrade' on all packs to update lock files"

0 commit comments

Comments
 (0)