Skip to content

Make deploy workflow idempotent for PyPI release reruns - #5

Merged
SpriteMisaka merged 2 commits into
mainfrom
copilot/fix-deploy-github-actions-job
Aug 27, 2026
Merged

Make deploy workflow idempotent for PyPI release reruns#5
SpriteMisaka merged 2 commits into
mainfrom
copilot/fix-deploy-github-actions-job

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

The deploy Actions job failed on release reruns because PyPI rejected re-upload of already-published artifacts (HTTP 400 Bad Request). This change makes the publish step tolerant of existing files so reruns are non-failing.

  • Root-cause alignment

    • The failing path was the PyPI publish action in .github/workflows/python-publish.yml, not package build output.
  • Workflow change

    • Updated pypa/gh-action-pypi-publish config to skip files that already exist on PyPI during reruns.
  • Resulting behavior

    • First publish for a new version still uploads normally.
    • Reruns for the same release no longer fail due to duplicate artifact upload attempts.
- name: Publish package
  uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
  with:
    user: __token__
    password: ${{ secrets.PYPI_API_TOKEN }}
    skip-existing: true

Sourcery 摘要

使 PyPI 发布具备幂等性,从而避免因重复构件导致发布重新运行失败。

错误修复:

  • 当该版本的构件已发布时,允许 PyPI 发布工作流重新运行并成功完成。

CI:

  • 配置 PyPI 发布工作流,跳过 PyPI 上已存在的构件。
Original summary in English

Summary by Sourcery

Make PyPI publishing idempotent so release reruns do not fail on duplicate artifacts.

Bug Fixes:

  • Allow PyPI release workflow reruns to succeed when artifacts for the version have already been published.

CI:

  • Configure the PyPI publishing workflow to skip artifacts that already exist on PyPI.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job deploy Make deploy workflow idempotent for PyPI release reruns Aug 27, 2026
Copilot AI requested a review from SpriteMisaka August 27, 2026 01:17
@SpriteMisaka SpriteMisaka reopened this Aug 27, 2026
@SpriteMisaka
SpriteMisaka marked this pull request as ready for review August 27, 2026 01:18
Copilot AI lite review requested due to automatic review settings August 27, 2026 01:18
@SpriteMisaka
SpriteMisaka merged commit 144fef0 into main Aug 27, 2026
2 checks passed
@sourcery-ai

sourcery-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown
审查者指南(小型 PR 中折叠显示)

审查者指南

部署工作流现在会在 PyPI 发布操作中设置 skip-existing: true,允许在构件已存在时重新运行同一版本的发布流程,同时保留新版本的标准发布行为。

幂等 PyPI 发布重新运行的时序图

sequenceDiagram
    participant Deploy as Deploy workflow
    participant PyPI as PyPI publish action
    participant Registry as PyPI registry

    Deploy->>PyPI: publish package
    PyPI->>Registry: upload artifacts
    alt artifacts are new
        Registry-->>PyPI: accept upload
        PyPI-->>Deploy: publish succeeds
    else artifacts already exist
        PyPI->>Registry: skip-existing: true
        Registry-->>PyPI: skip duplicates
        PyPI-->>Deploy: rerun succeeds
    end
Loading

文件级变更

变更 详细信息 文件
使 PyPI 发布能够容忍发布重新运行期间的重复构件。
  • 启用发布操作现有的文件跳过行为。
  • 对于尚未发布的构件,保留正常上传行为。
.github/workflows/python-publish.yml

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以使用 @sourcery-ai issue 回复审查评论,以根据该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,以随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中任意位置写入 @sourcery-ai summary,即可在你指定的位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,以随时(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想从头开始新的审查,这尤其有用——别忘了评论 @sourcery-ai review 来触发新的审查!

自定义你的体验

访问你的仪表板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The deploy workflow now sets skip-existing: true on the PyPI publish action, allowing reruns of the same release to succeed when artifacts already exist while retaining standard publishing behavior for new versions.

Sequence diagram for idempotent PyPI release reruns

sequenceDiagram
    participant Deploy as Deploy workflow
    participant PyPI as PyPI publish action
    participant Registry as PyPI registry

    Deploy->>PyPI: publish package
    PyPI->>Registry: upload artifacts
    alt artifacts are new
        Registry-->>PyPI: accept upload
        PyPI-->>Deploy: publish succeeds
    else artifacts already exist
        PyPI->>Registry: skip-existing: true
        Registry-->>PyPI: skip duplicates
        PyPI-->>Deploy: rerun succeeds
    end
Loading

File-Level Changes

Change Details Files
Make PyPI publishing tolerant of duplicate artifacts during release reruns.
  • Enable the publish action’s existing-file skip behavior.
  • Preserve normal uploads for artifacts that are not already published.
.github/workflows/python-publish.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

@sourcery-ai sourcery-ai Bot 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.

嗨——我已经审阅了你的更改,看起来很棒!


Sourcery 对开源项目免费——如果你喜欢我们的评审,欢迎分享 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用这些反馈来改进评审。
Original comment in English

Hey - I've reviewed your changes and they look great!


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.

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.

🟢 Approval recommended

The change is minimal, matches the stated root cause, and uses a supported publish-action option to make reruns non-failing without altering build or release semantics.

Pull request overview

Makes the PyPI publish workflow rerun-safe by configuring the publish action to tolerate already-uploaded artifacts, preventing release reruns from failing with duplicate upload errors.

Changes:

  • Configure pypa/gh-action-pypi-publish to skip-existing: true so reruns don’t fail on HTTP 400 Bad Request for existing files.
File summaries
File Description
.github/workflows/python-publish.yml Adds skip-existing: true to the PyPI publish step to make reruns idempotent.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@SpriteMisaka
SpriteMisaka deleted the copilot/fix-deploy-github-actions-job branch August 27, 2026 01:41
@SpriteMisaka
SpriteMisaka restored the copilot/fix-deploy-github-actions-job branch August 27, 2026 01:42
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.

3 participants