Skip to content

Refactor Python script to one-liner for asset check#3

Merged
axellpadilla merged 2 commits into
mainfrom
copilot/update-gh-release-action
May 9, 2026
Merged

Refactor Python script to one-liner for asset check#3
axellpadilla merged 2 commits into
mainfrom
copilot/update-gh-release-action

Conversation

@axellpadilla
Copy link
Copy Markdown
Collaborator

@axellpadilla axellpadilla commented May 9, 2026

Summary by Sourcery

Enhancements:

  • Refactor the release workflow's Python-based asset existence check into a compact one-liner while preserving its behavior.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the inline Python asset-check script in the release workflow into a single -c one-liner while preserving its behavior of deciding whether release assets are complete and whether a build is needed.

File-Level Changes

Change Details Files
Refactor the embedded Python asset-check script in the release workflow from a multi-line heredoc into a single -c one-liner while keeping logic and exit codes the same.
  • Replace the heredoc-based inline Python script with a python -c invocation using a single quoted command string.
  • Retain the JSON loading of the release metadata from RELEASE_JSON_PATH and extraction of asset names into a set.
  • Keep the required asset list (Windows zip and Linux tar.gz) and the subset check that determines whether assets are complete.
  • Preserve the exit-code contract: exit 0 when all required assets are present, exit 1 otherwise, so the surrounding shell logic continues to work as before.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The new python -c one-liner is significantly harder to read and maintain than the previous here-doc script; consider keeping the multi-line Python block or at least splitting the logic into clearer statements (e.g., using a small helper script) to make future changes less error-prone, especially around quoting and asset list updates.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `python -c` one-liner is significantly harder to read and maintain than the previous here-doc script; consider keeping the multi-line Python block or at least splitting the logic into clearer statements (e.g., using a small helper script) to make future changes less error-prone, especially around quoting and asset list updates.

## Individual Comments

### Comment 1
<location path=".github/workflows/release.yml" line_range="77" />
<code_context>
-if required.issubset(assets):
-    raise SystemExit(0)
-
-print("Required release assets missing, build needed.", file=sys.stderr)
-raise SystemExit(1)
-PY
</code_context>
<issue_to_address>
**issue:** The new version no longer prints a diagnostic message when required assets are missing, reducing debuggability.

Previously this script wrote a clear stderr message before exiting with status 1; now it fails silently, which makes CI logs harder to interpret. Please keep a brief stderr message (e.g., just before `sys.exit(1)`) so it’s obvious in logs why the build was triggered.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/release.yml
@axellpadilla axellpadilla merged commit 360f90e into main May 9, 2026
1 check passed
@axellpadilla axellpadilla deleted the copilot/update-gh-release-action branch May 9, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant