Skip to content

Commit 8fe4c39

Browse files
committed
merge main into 1.x — pick up #293; 1.x is the v1 maintenance line
2 parents dd4870d + 6a9ebda commit 8fe4c39

4 files changed

Lines changed: 29 additions & 108 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,36 @@ jobs:
9595
fi
9696
echo "codeanalyzer JAR present in wheel and sdist ✓"
9797
98-
- name: Read Changelog Entry
99-
id: changelog_reader
100-
uses: mindsers/changelog-reader-action@v2
101-
with:
102-
validation_level: warn
103-
version: ${{ steps.tag_name.outputs.current_version }}
104-
path: ./CHANGELOG.md
105-
106-
- name: Build Changelog
107-
id: gen_changelog
108-
uses: mikepenz/release-changelog-builder-action@v5
109-
with:
110-
failOnError: "true"
111-
configuration: .github/workflows/release_config.json
112-
env:
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
- name: Extract release notes from CHANGELOG.md
99+
id: notes
100+
# Source the release body from the hand-written CHANGELOG.md section for this tag —
101+
# deterministic and independent of PR labels — and refuse to publish/announce a blank
102+
# body. The previous label-based changelog scraper emitted nothing for unlabeled PRs,
103+
# which blanked the release and crashed the org announcement. See issue #289.
104+
run: |
105+
set -euo pipefail
106+
version="${GITHUB_REF#refs/tags/}" # e.g. v1.4.4 — matches the "## [v1.4.4]" heading
107+
notes=$(awk -v h="## [$version]" '
108+
!seen && index($0, h) == 1 { seen = 1; next }
109+
seen && index($0, "## [") == 1 { exit }
110+
seen { print }
111+
' CHANGELOG.md | sed '/./,$!d' | tac | sed '/./,$!d' | tac) # strip blank edges
112+
if [ -z "$notes" ]; then
113+
echo "::error::No CHANGELOG.md entry for $version — refusing to publish a blank release."
114+
exit 1
115+
fi
116+
{
117+
echo "notes<<__CHANGELOG_EOF__"
118+
echo "$notes"
119+
echo "__CHANGELOG_EOF__"
120+
} >> "$GITHUB_OUTPUT"
121+
echo "Release notes for $version:"; echo "$notes"
114122
115123
- name: Publish Release on GitHub
116124
uses: softprops/action-gh-release@v2
117125
with:
118126
files: dist/*
119-
body: ${{ steps.gen_changelog.outputs.changelog }}
127+
body: ${{ steps.notes.outputs.notes }}
120128
# Auto-open a repo-level Discussion linked to this release, seeded with
121129
# the same notes. Requires Discussions enabled and this category to exist.
122130
discussion_category_name: Announcements
@@ -126,13 +134,13 @@ jobs:
126134
# Mirror the release announcement into the ORG-level discussions, which are
127135
# backed by codellm-devkit/.github. GITHUB_TOKEN can't write cross-repo, so
128136
# this uses a PAT (ORG_DISCUSSIONS_TOKEN) with repo scope, and posts via the
129-
# createDiscussion GraphQL mutation. The body (the generated changelog) is
137+
# createDiscussion GraphQL mutation. The body (the CHANGELOG.md notes) is
130138
# passed via env to avoid shell-injection, matching the repo-level post.
131139
- name: Announce in org-level discussions (codellm-devkit/.github)
132140
continue-on-error: true # a failed org post must not fail an otherwise-good release
133141
env:
134142
GH_TOKEN: ${{ secrets.ORG_DISCUSSIONS_TOKEN }}
135-
BODY: ${{ steps.gen_changelog.outputs.changelog }}
143+
BODY: ${{ steps.notes.outputs.notes }}
136144
run: |
137145
set -uo pipefail
138146
VERSION="${GITHUB_REF#refs/tags/v}"

.github/workflows/release_config.json

Lines changed: 0 additions & 65 deletions
This file was deleted.

tests/analysis/java/test_jcodeanalyzer.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"""
2020

2121
import os
22-
import sys
2322
import json
2423
from typing import Dict, List, Tuple
2524
from unittest.mock import patch, MagicMock
@@ -197,27 +196,6 @@ def test_init_codeanalyzer_reuses_legacy_cache_when_compatible(test_fixture, cod
197196
assert compilation_unit.import_declarations[0].is_wildcard is False
198197

199198

200-
def test_get_codeanalyzer_exec(test_fixture, analysis_json, tmp_path):
201-
"""Should resolve the codeanalyzer native binary command (packaged binary only)."""
202-
203-
# Patch subprocess so that it does not run codeanalyzer
204-
with patch("cldk.analysis.java.codeanalyzer.codeanalyzer.subprocess.run") as run_mock:
205-
run_mock.return_value = MagicMock(stdout=analysis_json, returncode=0)
206-
207-
code_analyzer = JCodeanalyzer(
208-
project_dir=test_fixture,
209-
source_code=None,
210-
analysis_json_path=None,
211-
analysis_level=AnalysisLevel.symbol_table,
212-
eager_analysis=False,
213-
target_files=None,
214-
)
215-
216-
# The PyPI native binary, invoked via `python -m codeanalyzer_java`. There is no longer a
217-
# backend-path override (the binary ships with the packaged dependency).
218-
assert code_analyzer._get_codeanalyzer_exec() == [sys.executable, "-m", "codeanalyzer_java"]
219-
220-
221199
def test_generate_call_graph(test_fixture, analysis_json):
222200
"""Should generate a graph"""
223201

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def analysis_json(analysis_json_fixture) -> str:
6666
def codeanalyzer_backend_path():
6767
"""Backend-path override for the Java analyzer in tests.
6868
69-
Returns None so the analyzer uses its default: the JVM-free native binary shipped in the
70-
``codeanalyzer-java`` PyPI package (``python -m codeanalyzer_java``).
69+
Returns None so the analyzer uses its default: the ``codeanalyzer-*.jar`` bundled under
70+
``cldk/analysis/java/codeanalyzer/jar/``, run on a cached JDK (``[java, -jar, <jar>]``).
7171
"""
7272
return None
7373

0 commit comments

Comments
 (0)