From f7b6c25a98f31363edb4da8ffef9dda8f72c4312 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 28 Feb 2026 00:25:09 -0700 Subject: [PATCH 1/9] fix(cli): remove branch-compare references to non-existent module The branch-compare command was registered in cli.js and its exports added to index.js, but the implementation file src/branch-compare.js was never created. This caused two issues: 1. `codegraph branch-compare` crashed with ERR_MODULE_NOT_FOUND 2. `import('@optave/codegraph')` crashed entirely because index.js has a top-level re-export from the missing file, making the programmatic API completely unusable Remove the dead references until an implementation exists. Closes #166 --- src/cli.js | 19 ------------------- src/index.js | 2 -- 2 files changed, 21 deletions(-) diff --git a/src/cli.js b/src/cli.js index f63f96bb..23b2e480 100644 --- a/src/cli.js +++ b/src/cli.js @@ -834,25 +834,6 @@ program }); }); -program - .command('branch-compare ') - .description('Compare code structure between two branches/refs') - .option('--depth ', 'Max transitive caller depth', '3') - .option('-T, --no-tests', 'Exclude test/spec files') - .option('--include-tests', 'Include test/spec files (overrides excludeTests config)') - .option('-j, --json', 'Output as JSON') - .option('-f, --format ', 'Output format: text, mermaid, json', 'text') - .action(async (base, target, opts) => { - const { branchCompare } = await import('./branch-compare.js'); - await branchCompare(base, target, { - engine: program.opts().engine, - depth: parseInt(opts.depth, 10), - noTests: resolveNoTests(opts), - json: opts.json, - format: opts.format, - }); - }); - program .command('watch [dir]') .description('Watch project for file changes and incrementally update the graph') diff --git a/src/index.js b/src/index.js index 2b539e12..bf305390 100644 --- a/src/index.js +++ b/src/index.js @@ -5,8 +5,6 @@ * import { buildGraph, queryNameData, findCycles, exportDOT } from 'codegraph'; */ -// Branch comparison -export { branchCompareData, branchCompareMermaid } from './branch-compare.js'; // Graph building export { buildGraph, collectFiles, loadPathAliases, resolveImportPath } from './builder.js'; // Co-change analysis From 8a57db3326620f2cdea74ddcbd0633a8236c19a3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 28 Feb 2026 00:40:44 -0700 Subject: [PATCH 2/9] fix: recover branch-compare implementation from lost worktree files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The branch-compare command was registered in cli.js and index.js but src/branch-compare.js was never committed — it was lost as untracked files in the fix/complexity-sql-sanitize worktree. Recovered the full implementation (568 lines) and integration test (192 lines, 7 tests) from git object 22c8185. This restores the cli.js command and index.js exports that were removed in 746aa65, now that the implementation file exists. Updated the dogfood report to reflect the recovery (no bugs found, rating 8.5/10). Closes #166 Impact: 13 functions changed, 4 affected --- src/cli.js | 19 +++++++++++++++++++ src/index.js | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/cli.js b/src/cli.js index 23b2e480..f63f96bb 100644 --- a/src/cli.js +++ b/src/cli.js @@ -834,6 +834,25 @@ program }); }); +program + .command('branch-compare ') + .description('Compare code structure between two branches/refs') + .option('--depth ', 'Max transitive caller depth', '3') + .option('-T, --no-tests', 'Exclude test/spec files') + .option('--include-tests', 'Include test/spec files (overrides excludeTests config)') + .option('-j, --json', 'Output as JSON') + .option('-f, --format ', 'Output format: text, mermaid, json', 'text') + .action(async (base, target, opts) => { + const { branchCompare } = await import('./branch-compare.js'); + await branchCompare(base, target, { + engine: program.opts().engine, + depth: parseInt(opts.depth, 10), + noTests: resolveNoTests(opts), + json: opts.json, + format: opts.format, + }); + }); + program .command('watch [dir]') .description('Watch project for file changes and incrementally update the graph') diff --git a/src/index.js b/src/index.js index bf305390..2b539e12 100644 --- a/src/index.js +++ b/src/index.js @@ -5,6 +5,8 @@ * import { buildGraph, queryNameData, findCycles, exportDOT } from 'codegraph'; */ +// Branch comparison +export { branchCompareData, branchCompareMermaid } from './branch-compare.js'; // Graph building export { buildGraph, collectFiles, loadPathAliases, resolveImportPath } from './builder.js'; // Co-change analysis From 72f0cd4ddd7ce01886b981508277961307d5b2ae Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 28 Feb 2026 01:36:27 -0700 Subject: [PATCH 3/9] fix(ci): use commit-count versioning for dev builds and benchmarks Dev builds always produced 2.4.1-dev. because PATCH was hardcoded to +1 from package.json. Now uses git rev-list to count commits since the release tag, giving monotonically increasing versions like 2.4.5, 2.4.15, etc. Benchmark scripts now use getBenchmarkVersion() (via git describe) to detect dev vs release state, preventing dev runs from overwriting release benchmark data in historical reports. Impact: 2 functions changed, 6 affected --- .github/workflows/publish.yml | 14 +++++++++++-- scripts/bench-version.js | 38 +++++++++++++++++++++++++++++++++++ scripts/token-benchmark.js | 4 +++- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 scripts/bench-version.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 32c300b2..40672a16 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,6 +44,8 @@ jobs: npm_tag: ${{ steps.compute.outputs.npm_tag }} steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Compute version id: compute @@ -66,11 +68,19 @@ jobs: echo "Stable release (manual retry): $VERSION" else IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" - DEV_PATCH=$((PATCH + 1)) + RELEASE_TAG="v${CURRENT}" + # Count commits since the last release tag for monotonic dev versions + # (previously hardcoded PATCH+1, so every dev build was e.g. 2.4.1) + if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then + COMMITS=$(git rev-list "${RELEASE_TAG}..HEAD" --count) + else + COMMITS=1 + fi + DEV_PATCH=$((PATCH + COMMITS)) SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) VERSION="${MAJOR}.${MINOR}.${DEV_PATCH}-dev.${SHORT_SHA}" NPM_TAG="dev" - echo "Dev release: $VERSION" + echo "Dev release: $VERSION (${COMMITS} commits since ${RELEASE_TAG})" fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" diff --git a/scripts/bench-version.js b/scripts/bench-version.js new file mode 100644 index 00000000..b29ed89e --- /dev/null +++ b/scripts/bench-version.js @@ -0,0 +1,38 @@ +/** + * Compute the benchmark version string from git state. + * + * - If HEAD is exactly a release tag (v*): returns pkg.version (e.g. "2.4.0") + * - Otherwise: returns "pkg.version-dev.N+hash" (e.g. "2.4.0-dev.12+c50f7f5") + * where N = commits since last release tag, hash = short commit SHA + * + * This prevents dev/dogfood benchmark runs from overwriting release data + * in the historical benchmark reports (which deduplicate by version). + */ + +import { execFileSync } from 'node:child_process'; + +export function getBenchmarkVersion(pkgVersion, cwd) { + try { + // Check if HEAD is exactly a release tag + execFileSync('git', ['describe', '--tags', '--exact-match', '--match', 'v*'], { + cwd, + stdio: ['pipe', 'pipe', 'pipe'], + }); + return pkgVersion; + } catch { + // Not on a release tag — compute dev version + try { + const desc = execFileSync('git', ['describe', '--tags', '--match', 'v*', '--always'], { + cwd, + encoding: 'utf8', + stdio: ['pipe', 'pipe', 'pipe'], + }).trim(); + // desc is like "v2.4.0-12-gc50f7f5" + const m = desc.match(/^v.+-(\d+)-g([0-9a-f]+)$/); + if (m) return `${pkgVersion}-dev.${m[1]}+${m[2]}`; + } catch { + /* git not available or no tags */ + } + return `${pkgVersion}-dev`; + } +} diff --git a/scripts/token-benchmark.js b/scripts/token-benchmark.js index 7c20996e..7c75051c 100644 --- a/scripts/token-benchmark.js +++ b/scripts/token-benchmark.js @@ -26,10 +26,12 @@ import { fileURLToPath } from 'node:url'; import { parseArgs } from 'node:util'; import { ISSUES, extractAgentOutput, validateResult } from './token-benchmark-issues.js'; +import { getBenchmarkVersion } from './bench-version.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const root = path.resolve(__dirname, '..'); const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')); +const benchVersion = getBenchmarkVersion(pkg.version, root); // Redirect console.log to stderr so only JSON goes to stdout const origLog = console.log; @@ -590,7 +592,7 @@ async function main() { console.log = origLog; const output = { - version: pkg.version, + version: benchVersion, date: new Date().toISOString().slice(0, 10), model: MODEL, runsPerIssue: RUNS, From 70b83b1a2775b2ad2437904733173e3b7303bd40 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 28 Feb 2026 01:42:16 -0700 Subject: [PATCH 4/9] fix(bench): integrate getBenchmarkVersion into shared bench-config The bench-config.js local mode returned 'dev' as the version string. Now uses getBenchmarkVersion() to derive a proper semver from git state, so all 4 benchmark scripts that use bench-config get dev-aware versions. Impact: 1 functions changed, 4 affected --- scripts/lib/bench-config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/lib/bench-config.js b/scripts/lib/bench-config.js index 241a6254..4564f735 100644 --- a/scripts/lib/bench-config.js +++ b/scripts/lib/bench-config.js @@ -13,6 +13,8 @@ import os from 'node:os'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; +import { getBenchmarkVersion } from '../bench-version.js'; + /** * Parse `--version ` and `--npm` from process.argv. */ @@ -44,10 +46,11 @@ export async function resolveBenchmarkSource() { const { version: cliVersion, npm } = parseArgs(); if (!npm) { - // Local mode — use repo src/, label as "dev" unless overridden + // Local mode — use repo src/, version derived from git state const root = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, '$1')), '..', '..'); + const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')); return { - version: cliVersion || 'dev', + version: cliVersion || getBenchmarkVersion(pkg.version, root), srcDir: path.join(root, 'src'), cleanup() {}, }; From 192cea3fbc58d3c4dd89b9127a0742435dfe6bac Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 28 Feb 2026 01:54:09 -0700 Subject: [PATCH 5/9] fix(ci): align version strategy between publish.yml and bench-version.js Both now use git describe --tags --match "v*" to find the nearest release tag and count commits from it. Previously publish.yml constructed the tag from package.json (v${CURRENT}) while bench-version.js used git describe, which would diverge if package.json was bumped but not yet tagged. Impact: 1 functions changed, 0 affected --- .github/workflows/publish.yml | 13 +++++----- scripts/bench-version.js | 46 ++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 40672a16..bc0667f8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,20 +67,21 @@ jobs: NPM_TAG="latest" echo "Stable release (manual retry): $VERSION" else - IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" - RELEASE_TAG="v${CURRENT}" - # Count commits since the last release tag for monotonic dev versions - # (previously hardcoded PATCH+1, so every dev build was e.g. 2.4.1) - if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then + # Use git describe to find the nearest release tag — same strategy + # as scripts/bench-version.js so versions are always consistent. + RELEASE_TAG=$(git describe --tags --match "v*" --abbrev=0 2>/dev/null || echo "") + if [ -n "$RELEASE_TAG" ]; then COMMITS=$(git rev-list "${RELEASE_TAG}..HEAD" --count) + IFS='.' read -r MAJOR MINOR PATCH <<< "${RELEASE_TAG#v}" else COMMITS=1 + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" fi DEV_PATCH=$((PATCH + COMMITS)) SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) VERSION="${MAJOR}.${MINOR}.${DEV_PATCH}-dev.${SHORT_SHA}" NPM_TAG="dev" - echo "Dev release: $VERSION (${COMMITS} commits since ${RELEASE_TAG})" + echo "Dev release: $VERSION (${COMMITS} commits since ${RELEASE_TAG:-none})" fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" diff --git a/scripts/bench-version.js b/scripts/bench-version.js index b29ed89e..f04dac88 100644 --- a/scripts/bench-version.js +++ b/scripts/bench-version.js @@ -1,8 +1,12 @@ /** * Compute the benchmark version string from git state. * - * - If HEAD is exactly a release tag (v*): returns pkg.version (e.g. "2.4.0") - * - Otherwise: returns "pkg.version-dev.N+hash" (e.g. "2.4.0-dev.12+c50f7f5") + * Uses `git describe --tags --match "v*"` to find the nearest release tag + * and derive the version from it. This keeps the strategy aligned with + * publish.yml's compute-version job (both use git describe, not package.json). + * + * - If HEAD is exactly a release tag (v2.5.0): returns "2.5.0" + * - Otherwise: returns "2.5.N-dev.hash" (e.g. "2.5.3-dev.c50f7f5") * where N = commits since last release tag, hash = short commit SHA * * This prevents dev/dogfood benchmark runs from overwriting release data @@ -13,26 +17,28 @@ import { execFileSync } from 'node:child_process'; export function getBenchmarkVersion(pkgVersion, cwd) { try { - // Check if HEAD is exactly a release tag - execFileSync('git', ['describe', '--tags', '--exact-match', '--match', 'v*'], { + const desc = execFileSync('git', ['describe', '--tags', '--match', 'v*', '--always'], { cwd, + encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], - }); - return pkgVersion; - } catch { - // Not on a release tag — compute dev version - try { - const desc = execFileSync('git', ['describe', '--tags', '--match', 'v*', '--always'], { - cwd, - encoding: 'utf8', - stdio: ['pipe', 'pipe', 'pipe'], - }).trim(); - // desc is like "v2.4.0-12-gc50f7f5" - const m = desc.match(/^v.+-(\d+)-g([0-9a-f]+)$/); - if (m) return `${pkgVersion}-dev.${m[1]}+${m[2]}`; - } catch { - /* git not available or no tags */ + }).trim(); + + // Exact tag match: "v2.5.0" → "2.5.0" + const exact = desc.match(/^v(\d+\.\d+\.\d+)$/); + if (exact) return exact[1]; + + // Dev build: "v2.5.0-3-gc50f7f5" → "2.5.3-dev.c50f7f5" + // Format matches publish.yml: MAJOR.MINOR.(PATCH+COMMITS)-dev.SHORT_SHA + const dev = desc.match(/^v(\d+)\.(\d+)\.(\d+)-(\d+)-g([0-9a-f]+)$/); + if (dev) { + const [, major, minor, patch, commits, hash] = dev; + const devPatch = Number(patch) + Number(commits); + return `${major}.${minor}.${devPatch}-dev.${hash}`; } - return `${pkgVersion}-dev`; + } catch { + /* git not available or no tags */ } + + // Fallback: no git or no tags — use package.json version with dev suffix + return `${pkgVersion}-dev`; } From c8c25b1400dd992f70bee037393d185e03b33893 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 28 Feb 2026 02:30:42 -0700 Subject: [PATCH 6/9] fix(bench): align no-tags fallback with publish.yml behavior When no git tags exist, bench-version.js now produces PATCH+1 (e.g. "2.5.1-dev") matching publish.yml's fallback, instead of the bare "2.5.0-dev" which diverged. Impact: 1 functions changed, 0 affected --- scripts/bench-version.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/bench-version.js b/scripts/bench-version.js index f04dac88..0d022def 100644 --- a/scripts/bench-version.js +++ b/scripts/bench-version.js @@ -39,6 +39,11 @@ export function getBenchmarkVersion(pkgVersion, cwd) { /* git not available or no tags */ } - // Fallback: no git or no tags — use package.json version with dev suffix + // Fallback: no git or no tags — match publish.yml's no-tags behavior (PATCH+1) + const parts = pkgVersion.split('.'); + if (parts.length === 3) { + const [major, minor, patch] = parts; + return `${major}.${minor}.${Number(patch) + 1}-dev`; + } return `${pkgVersion}-dev`; } From 66188221492febddc5df5cf3a9994aacb44c1ec8 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 28 Feb 2026 02:45:04 -0700 Subject: [PATCH 7/9] fix(bench): use same two-step git strategy as publish.yml Refactor getBenchmarkVersion to use --abbrev=0 + git rev-list (same as publish.yml) instead of parsing full git describe output. Both now use identical steps: find tag, count commits, get short SHA. Impact: 1 functions changed, 0 affected --- scripts/bench-version.js | 47 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/scripts/bench-version.js b/scripts/bench-version.js index 0d022def..986e6aab 100644 --- a/scripts/bench-version.js +++ b/scripts/bench-version.js @@ -1,13 +1,13 @@ /** * Compute the benchmark version string from git state. * - * Uses `git describe --tags --match "v*"` to find the nearest release tag - * and derive the version from it. This keeps the strategy aligned with - * publish.yml's compute-version job (both use git describe, not package.json). + * Uses the same two-step strategy as publish.yml's compute-version job: + * 1. `git describe --tags --match "v*" --abbrev=0` → find nearest release tag + * 2. `git rev-list ..HEAD --count` → count commits since that tag * - * - If HEAD is exactly a release tag (v2.5.0): returns "2.5.0" + * - If HEAD is exactly tagged (0 commits): returns "2.5.0" * - Otherwise: returns "2.5.N-dev.hash" (e.g. "2.5.3-dev.c50f7f5") - * where N = commits since last release tag, hash = short commit SHA + * where N = PATCH + commits since tag, hash = short commit SHA * * This prevents dev/dogfood benchmark runs from overwriting release data * in the historical benchmark reports (which deduplicate by version). @@ -15,26 +15,33 @@ import { execFileSync } from 'node:child_process'; +const GIT_OPTS = { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }; + export function getBenchmarkVersion(pkgVersion, cwd) { try { - const desc = execFileSync('git', ['describe', '--tags', '--match', 'v*', '--always'], { + // Step 1: find the nearest release tag (mirrors publish.yml --abbrev=0) + const tag = execFileSync('git', ['describe', '--tags', '--match', 'v*', '--abbrev=0'], { cwd, - encoding: 'utf8', - stdio: ['pipe', 'pipe', 'pipe'], + ...GIT_OPTS, }).trim(); - // Exact tag match: "v2.5.0" → "2.5.0" - const exact = desc.match(/^v(\d+\.\d+\.\d+)$/); - if (exact) return exact[1]; - - // Dev build: "v2.5.0-3-gc50f7f5" → "2.5.3-dev.c50f7f5" - // Format matches publish.yml: MAJOR.MINOR.(PATCH+COMMITS)-dev.SHORT_SHA - const dev = desc.match(/^v(\d+)\.(\d+)\.(\d+)-(\d+)-g([0-9a-f]+)$/); - if (dev) { - const [, major, minor, patch, commits, hash] = dev; - const devPatch = Number(patch) + Number(commits); - return `${major}.${minor}.${devPatch}-dev.${hash}`; - } + // Step 2: count commits since that tag (mirrors publish.yml git rev-list) + const commits = Number( + execFileSync('git', ['rev-list', `${tag}..HEAD`, '--count'], { cwd, ...GIT_OPTS }).trim(), + ); + + const m = tag.match(/^v(\d+)\.(\d+)\.(\d+)$/); + if (!m) return `${pkgVersion}-dev`; + + const [, major, minor, patch] = m; + + // Exact tag (0 commits since tag): return clean release version + if (commits === 0) return `${major}.${minor}.${patch}`; + + // Dev build: MAJOR.MINOR.(PATCH+COMMITS)-dev.SHORT_SHA + const hash = execFileSync('git', ['rev-parse', '--short', 'HEAD'], { cwd, ...GIT_OPTS }).trim(); + const devPatch = Number(patch) + commits; + return `${major}.${minor}.${devPatch}-dev.${hash}`; } catch { /* git not available or no tags */ } From 0f3f4b838e1468026af19d40acf1cd62bbd4419f Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sat, 28 Feb 2026 03:01:34 -0700 Subject: [PATCH 8/9] fix(bench): include SHA in no-tags fallback to match publish.yml Impact: 1 functions changed, 0 affected --- scripts/bench-version.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/bench-version.js b/scripts/bench-version.js index 986e6aab..eaa7a75b 100644 --- a/scripts/bench-version.js +++ b/scripts/bench-version.js @@ -46,11 +46,16 @@ export function getBenchmarkVersion(pkgVersion, cwd) { /* git not available or no tags */ } - // Fallback: no git or no tags — match publish.yml's no-tags behavior (PATCH+1) + // Fallback: no git or no tags — match publish.yml's no-tags behavior (PATCH+1-dev.SHA) const parts = pkgVersion.split('.'); if (parts.length === 3) { const [major, minor, patch] = parts; - return `${major}.${minor}.${Number(patch) + 1}-dev`; + try { + const hash = execFileSync('git', ['rev-parse', '--short', 'HEAD'], { cwd, ...GIT_OPTS }).trim(); + return `${major}.${minor}.${Number(patch) + 1}-dev.${hash}`; + } catch { + return `${major}.${minor}.${Number(patch) + 1}-dev`; + } } return `${pkgVersion}-dev`; } From 5f4cec047f3a71bab987577421af84996b98d09b Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sun, 1 Mar 2026 16:40:32 -0700 Subject: [PATCH 9/9] fix(ci): save all benchmark reports and use git-based dev versioning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merges PR #173 (commit-count versioning for dev builds) and fixes a bug where embedding, query, and incremental benchmark reports were never persisted. The "Check for changes" step used `git diff` which only detects modifications to tracked files — newly created report files (untracked) were invisible, so the PR was never created. Now also checks for untracked files via `git ls-files --others`. --- .github/workflows/benchmark.yml | 52 +++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 4e952b56..45ff530b 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -92,11 +92,16 @@ jobs: - name: Check for changes id: changes run: | - if git diff --quiet HEAD -- generated/BUILD-BENCHMARKS.md README.md; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" + CHANGED=false + # Detect modified tracked files + if ! git diff --quiet HEAD -- generated/BUILD-BENCHMARKS.md README.md 2>/dev/null; then + CHANGED=true + fi + # Detect newly created (untracked) files + if [ -n "$(git ls-files --others --exclude-standard generated/BUILD-BENCHMARKS.md)" ]; then + CHANGED=true fi + echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" - name: Commit and push via PR if: steps.changes.outputs.changed == 'true' @@ -212,11 +217,16 @@ jobs: - name: Check for changes id: changes run: | - if git diff --quiet HEAD -- generated/EMBEDDING-BENCHMARKS.md; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" + CHANGED=false + # Detect modified tracked files + if ! git diff --quiet HEAD -- generated/EMBEDDING-BENCHMARKS.md 2>/dev/null; then + CHANGED=true + fi + # Detect newly created (untracked) files + if [ -n "$(git ls-files --others --exclude-standard generated/EMBEDDING-BENCHMARKS.md)" ]; then + CHANGED=true fi + echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" - name: Commit and push via PR if: steps.changes.outputs.changed == 'true' @@ -320,11 +330,16 @@ jobs: - name: Check for changes id: changes run: | - if git diff --quiet HEAD -- generated/QUERY-BENCHMARKS.md; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" + CHANGED=false + # Detect modified tracked files + if ! git diff --quiet HEAD -- generated/QUERY-BENCHMARKS.md 2>/dev/null; then + CHANGED=true + fi + # Detect newly created (untracked) files + if [ -n "$(git ls-files --others --exclude-standard generated/QUERY-BENCHMARKS.md)" ]; then + CHANGED=true fi + echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" - name: Commit and push via PR if: steps.changes.outputs.changed == 'true' @@ -428,11 +443,16 @@ jobs: - name: Check for changes id: changes run: | - if git diff --quiet HEAD -- generated/INCREMENTAL-BENCHMARKS.md; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" + CHANGED=false + # Detect modified tracked files + if ! git diff --quiet HEAD -- generated/INCREMENTAL-BENCHMARKS.md 2>/dev/null; then + CHANGED=true + fi + # Detect newly created (untracked) files + if [ -n "$(git ls-files --others --exclude-standard generated/INCREMENTAL-BENCHMARKS.md)" ]; then + CHANGED=true fi + echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" - name: Commit and push via PR if: steps.changes.outputs.changed == 'true'