Refactor verify-action-build into modular package with tests#675
Refactor verify-action-build into modular package with tests#675
Conversation
Split the 3068-line monolithic script into 15 focused modules organized by responsibility (GitHub client, action parsing, Docker building, diff engines, security analysis, PR extraction, etc.), extracted the inline Dockerfile to a standalone file, and added 112 unit tests. Generated-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously force_terminal=False was passed outside CI, disabling color on real terminals. Now we only override Rich defaults inside CI. Generated-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
RAT check failed because these empty files had no license header. Generated-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hey @raboof -> since the tool has gone through a series of iterations and seems to be getting closer to regular maintenance - as asked in the #652 (comment), this one should make it far easier to review further changes. |
Replace `uv run utils/verify-action-build.py` with `uv run --directory utils verify-action-build` in README, PR template, CI workflow, and package docstring. Generated-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
uv run doesn't install console script entry points, so the --directory approach doesn't work. Keep a thin wrapper script with PEP 723 metadata that delegates to the package, preserving the original invocation that docs, CI, and users expect. Generated-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5541d43 to
2a3532b
Compare
|
I'd really love to merge that one - to be able to extend it's functionality further - I do not want to add more to the monolithical code that is now split, so I'd really love to get it merged,. |
|
It's generally - pretty safe refactor splitting the code into modules + adding plenty of tests to cover each module - this also will help us to make changes more safely - with test harness keeping the existing functionality. |
raboof
left a comment
There was a problem hiding this comment.
I'm no Python expert but this looks more managable to me.
It is common to have implementation and tests split over utils/tests/verify_action_build and utils/verify_action_build?
Yes - absolutely, this is recommended project structure (and with pyproject.toml in subdir we are heading into The closest we can get to "standard" in structure of the project is https://packaging.python.org/en/latest/tutorials/packaging-projects/ - this one suggests "src" as a "proper" subdirectory of For projects that are supposed to be really "CLI / embedded tools" - no src is better choice, because when you invoke such command - via For projects that are destined to be distributed as distribution packages (and this is the goal of https://packaging.python.org/en/latest/tutorials/packaging-projects/ ) - the "src" is better as it allows you to add more directories and make it easier to only choose src when preparing distributions. In Airflow we have both (and it's fine). For example:
|
Summary
utils/verify-action-build.pyinto 15 focused modules organized by responsibilitydockerfiles/build_action.Dockerfilefilepyproject.tomlfilesModule structure
console.pyUserQuit,ask_confirm,link,rungithub_client.pyGitHubClientclass (gh CLI + REST API)action_ref.pyorg/repo@hash, extractinguses:refs, detecting action typeapproved_actions.pyactions.ymldatabase interactiondocker_build.pydiff_display.pydiff_js.pydiff_node_modules.pynode_modulescomparisondiff_source.pysecurity.pyanalyze_*security check functionspr_extraction.pydependabot.pyverification.pycli.pymain()entry pointTest plan
uv run pytest utils/tests/ -v)uv run pytest -v— 161 total)uv run verify-action-build <action_ref>🤖 Generated with Claude Code