Skip to content

Skip PyPI publishing for GitHub pre-releases#2800

Merged
xingyaoww merged 1 commit intomainfrom
skip-pypi-for-prerelease
Apr 10, 2026
Merged

Skip PyPI publishing for GitHub pre-releases#2800
xingyaoww merged 1 commit intomainfrom
skip-pypi-for-prerelease

Conversation

@xingyaoww
Copy link
Copy Markdown
Collaborator

@xingyaoww xingyaoww commented Apr 10, 2026

Summary

When creating a GitHub release with the "Set as a pre-release" checkbox checked, the pypi-release workflow will now skip the publish job. This allows cutting release candidates or test releases on GitHub without pushing packages to PyPI.

How it works

  • Added an if condition to the publish job in pypi-release.yml that checks github.event.release.prerelease
  • When a pre-release is published → PyPI publish is skipped
  • When a regular release is published → PyPI publish runs as before
  • Manual workflow_dispatch is unaffected and always publishes

Downstream effects

The version-bump-prs workflow already guards on workflow_run.conclusion == 'success', so it naturally won't create version-bump PRs when pypi-release is skipped due to a pre-release. No changes needed there.

Usage

To create a pre-release that doesn't push to PyPI:

  1. Go to Releases → New release
  2. Create the tag and fill in release notes
  3. Check "Set as a pre-release"
  4. Publish

The release will be created on GitHub (visible to the team, with artifacts) but nothing will be published to PyPI.


This PR was created by an AI assistant (OpenHands).


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:49f5c84-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-49f5c84-python \
  ghcr.io/openhands/agent-server:49f5c84-python

All tags pushed for this build

ghcr.io/openhands/agent-server:49f5c84-golang-amd64
ghcr.io/openhands/agent-server:49f5c84-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:49f5c84-golang-arm64
ghcr.io/openhands/agent-server:49f5c84-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:49f5c84-java-amd64
ghcr.io/openhands/agent-server:49f5c84-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:49f5c84-java-arm64
ghcr.io/openhands/agent-server:49f5c84-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:49f5c84-python-amd64
ghcr.io/openhands/agent-server:49f5c84-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:49f5c84-python-arm64
ghcr.io/openhands/agent-server:49f5c84-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:49f5c84-golang
ghcr.io/openhands/agent-server:49f5c84-java
ghcr.io/openhands/agent-server:49f5c84-python

About Multi-Architecture Support

  • Each variant tag (e.g., 49f5c84-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 49f5c84-python-amd64) are also available if needed

When creating a GitHub release with the 'Set as a pre-release' checkbox
checked, the pypi-release workflow will now skip the publish job. This
allows cutting release candidates or test releases on GitHub without
pushing packages to PyPI.

The version-bump-prs workflow already guards on
workflow_run.conclusion == 'success', so it naturally won't create
version-bump PRs when pypi-release is skipped.

Manual workflow_dispatch is unaffected and always publishes.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions
Copy link
Copy Markdown
Contributor

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

@github-actions
Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result:PASSED

Action log

@xingyaoww xingyaoww marked this pull request as ready for review April 10, 2026 14:42
@xingyaoww xingyaoww enabled auto-merge (squash) April 10, 2026 14:43
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

🟢 Good taste - Simple, elegant solution that eliminates the special case of testing releases.

@xingyaoww xingyaoww merged commit 7044805 into main Apr 10, 2026
29 checks passed
@xingyaoww xingyaoww deleted the skip-pypi-for-prerelease branch April 10, 2026 14:44
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

QA Report: Skip PyPI Publishing for GitHub Pre-releases

Verdict: ⚠️ PASS WITH ISSUES


Summary

The workflow change correctly implements the ability to skip PyPI publishing for pre-releases. The conditional logic works as designed for all three scenarios (workflow_dispatch, regular release, pre-release). One minor suggestion for improved robustness.


Environment Setup

YAML syntax validation: Valid (yamllint)
Workflow validation: No errors (actionlint)
Repository context: Successfully checked out PR branch at commit bb5461d


CI & Test Status

All CI checks PASSING:

  • pre-commit: SUCCESS
  • Python API: SUCCESS
  • REST API (OpenAPI): SUCCESS
  • sdk-tests: SUCCESS
  • tools-tests: SUCCESS
  • agent-server-tests: SUCCESS
  • cross-tests: SUCCESS

Functional Verification

✅ Conditional Logic Analysis

Verified the workflow conditional handles all three scenarios correctly:

1. Manual workflow_dispatch trigger:

  • github.event_name == 'workflow_dispatch' → true
  • !github.event.release.prerelease → true (undefined → truthy)
  • Result: Publish runs

2. Regular release (prerelease=false):

  • github.event_name == 'workflow_dispatch' → false
  • !github.event.release.prerelease → !false → true
  • Result: Publish runs

3. Pre-release (prerelease=true):

  • github.event_name == 'workflow_dispatch' → false
  • !github.event.release.prerelease → !true → false
  • Result: Publish is skipped

✅ Downstream Effects Verification

Verified the claim about version-bump-prs workflow:

# Checked .github/workflows/version-bump-prs.yml line 22-25:
if: >
    github.event_name == 'workflow_dispatch' ||
    (github.event.workflow_run.conclusion == 'success' &&
     github.event.workflow_run.event == 'release')

Confirmed: When the publish job is skipped due to a pre-release, the workflow conclusion will not be 'success', so version-bump-prs will correctly NOT trigger. No changes needed there.


Unable to Verify

Functional testing with actual GitHub releases: Cannot trigger real GitHub releases in this QA environment to verify:

  • Creating a pre-release actually skips PyPI publish
  • Creating a regular release actually publishes to PyPI
  • Manual workflow_dispatch trigger works correctly

Suggested AGENTS.md guidance for future workflow QA:

## Verifying GitHub Actions Workflow Changes

For workflow changes that cannot be fully tested in the QA environment:
1. Validate YAML/workflow syntax with actionlint
2. Verify conditional logic through scenario analysis
3. Check CI passes on the PR
4. After merge: Monitor actual workflow runs in the Actions tab
5. For critical workflows: Test in a fork or test repository first

Issues Found

🟡 Minor: Conditional expression could be more explicit and defensive (see inline comment)


Verdict

⚠️ PASS WITH ISSUES: The change works as designed and CI passes. The conditional logic is correct but could be improved for better explicitness. This is a minor suggestion that doesn't block merging.

Recommendation: Consider applying the suggested change for improved code clarity, or merge as-is if you're confident in GitHub Actions' handling of undefined properties.


This QA report was generated by an AI assistant (OpenHands) following the /qa-changes methodology.

# pushing packages to PyPI. Manual workflow_dispatch always runs.
if: >
github.event_name == 'workflow_dispatch' ||
!github.event.release.prerelease
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟡 Suggestion: Consider making the conditional more explicit to avoid relying on undefined property handling:

Suggested change
!github.event.release.prerelease
(github.event_name == 'release' && !github.event.release.prerelease)

The current version works but accesses github.event.release.prerelease even when the release object doesn't exist (during workflow_dispatch). While GitHub Actions handles this gracefully by treating undefined as falsy, being explicit about the event type makes the logic clearer and more defensive.

Alternatively, keep the current version if you prefer brevity and are confident in GitHub Actions' undefined handling.

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