Skip to content

Refactor: Resolve the project name via metadata - #233

Merged
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-219
Nov 24, 2026
Merged

ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-219

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #219

Authored by an AI agent; human review required
Command Exit
bash tests/test-artefact-safety.sh 0
uvx zizmor --persona auditor --offline .github/workflows/testing.yaml action.yaml 0
AISLOP_NO_TELEMETRY=1 aislop scan --base bc9bf0ee29e8a4e188c8fc1f3591f4251be7815b --json 0
prek run --hook-stage commit-msg --commit-msg-filename /tmp/msg2.txt 0
prek run --files .github/workflows/testing.yaml README.md action.yaml 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.

Round 1 of revision, on its base.


Replaces python-project-name-action with build-metadata-action (pinned to the v0.13.2 commit 689e136) as the source of the project name this action downloads, checks and reports by. python-build-action uploads its artefact under build-metadata-action's project_name, so both ends now read the same parser. The action's inputs and outputs do not change.

Changes

  • action.yaml: the naming step uses build-metadata-action with use_version_extract, include_environment, artifact_upload off, an empty output_format and python_offline_mode on; the download, version check and summary read steps.naming.outputs.project_name.
  • action.yaml: a new Verify project name step fails with ::error:: when the name is empty, before any download. Given an empty name, download-artifact would fetch every artefact in the run.
  • README.md: the naming step row links build-metadata-action.
  • .github/workflows/testing.yaml: new no-project job runs the action against a directory with no Python project and expects it to fail.

build-metadata-action adds actions/setup-go and a go build of that action to the publishing job, about half a minute.

This round

Copilot pointed out that the negative test could pass without the guard: an unnamed download lands in per-artefact subdirectories under $RUNNER_TEMP/pypi-download.*, which distribution selection ignores before it fails, so no-project/dist stays absent either way. The job now uploads a sentinel artefact first and asserts that the download staging directory exists and is recursively empty. I simulated the assertion locally against a missing, an empty and a populated staging directory, and it failed or passed as expected in each case.

Checks run

  • prek run --files .github/workflows/testing.yaml README.md action.yaml: passed
  • commit-msg hooks (gitlint) on the commit message: passed
  • zizmor --persona auditor: no findings
  • aislop scan --base <base> with telemetry off: empty diagnostics
  • bash tests/test-artefact-safety.sh: passed

For the reviewer

The no-project job and the existing artefact-safety job only prove themselves in CI, because this runner cannot run the action end to end.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The empty-name guard assertions can pass even after unintended downloads because they check the final destination rather than the download staging directories, leaving a regression undetected.

1 open issue
What changed in this PR

This PR aligns publishing with the build action’s metadata-based project naming, addressing #219 while keeping the action’s public inputs and outputs unchanged.

Changes:

  • Replaces the project-name resolver with pinned build-metadata-action and updates consumers to use project_name.
  • Adds an empty-name check before artefact downloads and a negative CI job.
  • Updates the README’s naming sub-action link.
File Description
README.md Repoints the naming sub-action link to build-metadata-action.
action.yaml Switches name resolution, updates output references, and rejects empty names.
.github/​workflows/​testing.yaml Adds a negative test for a directory without project metadata.

Review effort: Balanced

Comment thread .github/workflows/testing.yaml Resolved
Read the project name from build-metadata-action instead of
python-project-name-action. python-build-action uploads its artefact
under build-metadata-action's project_name, so downloading under the
same output removes the need for two parsers to agree, and drops one
of the last callers of python-project-name-action ahead of its
retirement.

build-metadata-action succeeds with an empty name when the directory
holds no project it can name, and download-artifact given an empty
name downloads every artefact in the run. Fail with an error before
any download when the name is empty, and add a workflow job that
runs the action against a directory without a project and expects
that failure.

The step's inputs skip version extraction, environment probing,
release-data lookups, the metadata artefact upload and the summary
table, none of which the name needs. Inputs and outputs of this
action do not change.

The negative job uploads a sentinel artefact before running the
action and asserts that the download staging directory exists and
stays empty. Checking only the artefact path could pass without the
guard, since an unnamed download lands in per-artefact subdirectories
that distribution selection ignores before failing (Copilot review).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues remain: Poetry-only projects are rejected because their names are not extracted, and mixed Python/Node projects can use the Node package name for PyPI release checks and trusted-publishing selection.

2 open issues

Review effort: Balanced

Comment thread action.yaml Resolved
Comment thread action.yaml Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Resolve the project name via metadata

2 participants