Skip to content

Commit ee4e1f5

Browse files
committed
Fix CI: black formatting + exclude changelog from per-package check discovery
Two CI failures on PR #46016: 1. static-analysis (black): changelog.py and test_changelog_commands.py failed 'black --check'. Applied black with the repo's eng/black-pyproject.toml config. 2. verify-azpysdk-checks: the workflow discovers checks by scraping 'azpysdk -h' and invokes each one as 'azpysdk <check> --isolate <package>'. The changelog command group rejects --isolate (it's a developer tool wrapping Chronus, not a per-package check) and exits 2. Filter 'changelog' out of the discovery pipeline, same way 'next-*' checks are already filtered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0be4bc1 commit ee4e1f5

3 files changed

Lines changed: 32 additions & 20 deletions

File tree

.github/workflows/azure-sdk-tools.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,16 @@ jobs:
7272
run: |
7373
uv pip install --system eng/tools/azure-sdk-tools[ghtools,conda,systemperf]
7474
75-
# Discover available azpysdk commands from the {command1,command2,...} line in help output
75+
# Discover available azpysdk commands from the {command1,command2,...} line in help output.
76+
# `changelog` is filtered out because it is a developer command group (add/verify/create/status)
77+
# that wraps Chronus, not a per-package check, so the dispatcher cannot invoke it positionally.
7678
CHECKS=$(azpysdk -h 2>&1 | \
7779
grep -oP '\{[^}]+\}' | \
7880
tail -1 | \
7981
tr -d '{}' | \
8082
tr ',' '\n' | \
8183
grep -v '^next-' | \
84+
grep -v '^changelog$' | \
8285
sort | \
8386
paste -sd,)
8487

eng/tools/azure-sdk-tools/azpysdk/changelog.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,17 @@ def register(
8080
),
8181
)
8282
add_p.add_argument(
83-
"--kind", "-k",
83+
"--kind",
84+
"-k",
8485
choices=_CHANGE_KINDS,
8586
default=None,
86-
help=(
87-
"Kind of change (e.g. breaking, feature, fix). "
88-
"If omitted, chronus will prompt interactively."
89-
),
87+
help=("Kind of change (e.g. breaking, feature, fix). " "If omitted, chronus will prompt interactively."),
9088
)
9189
add_p.add_argument(
92-
"--message", "-m",
90+
"--message",
91+
"-m",
9392
default=None,
94-
help=(
95-
"Short description of the change. "
96-
"If omitted, chronus will prompt interactively."
97-
),
93+
help=("Short description of the change. " "If omitted, chronus will prompt interactively."),
9894
)
9995
add_p.set_defaults(func=self._run_add)
10096

@@ -103,9 +99,7 @@ def register(
10399
verify_p.set_defaults(func=self._run_verify)
104100

105101
# changelog create
106-
create_p = changelog_sub.add_parser(
107-
"create", help="Generate CHANGELOG.md from pending chronus entries"
108-
)
102+
create_p = changelog_sub.add_parser("create", help="Generate CHANGELOG.md from pending chronus entries")
109103
create_p.set_defaults(func=self._run_create)
110104

111105
# changelog status

eng/tools/azure-sdk-tools/tests/test_changelog_commands.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# Helper – build a minimal parser that includes the changelog subcommands
2222
# ---------------------------------------------------------------------------
2323

24+
2425
def _build_parser():
2526
parser = argparse.ArgumentParser(prog="azpysdk")
2627
subparsers = parser.add_subparsers(title="commands", dest="command")
@@ -256,16 +257,30 @@ def test_add_with_message_passes_flag(self, mock_which, mock_call, _mock_install
256257
def test_add_with_kind_message_and_package(self, mock_which, mock_call, _mock_installed):
257258
"""All flags (package, --kind, --message) should be forwarded together."""
258259
parser = _build_parser()
259-
args = parser.parse_args([
260-
"changelog", "add", "sdk/core/azure-core",
261-
"--kind", "breaking", "-m", "Removed deprecated API",
262-
])
260+
args = parser.parse_args(
261+
[
262+
"changelog",
263+
"add",
264+
"sdk/core/azure-core",
265+
"--kind",
266+
"breaking",
267+
"-m",
268+
"Removed deprecated API",
269+
]
270+
)
263271
result = args.func(args)
264272
assert result == 0
265273
cmd = mock_call.call_args[0][0]
266274
assert cmd == [
267-
"/usr/bin/npx", "--no", "chronus", "add", "azure-core",
268-
"--kind", "breaking", "--message", "Removed deprecated API",
275+
"/usr/bin/npx",
276+
"--no",
277+
"chronus",
278+
"add",
279+
"azure-core",
280+
"--kind",
281+
"breaking",
282+
"--message",
283+
"Removed deprecated API",
269284
]
270285

271286
@patch("azpysdk.changelog.changelog._is_chronus_installed", return_value=True)

0 commit comments

Comments
 (0)