Skip to content

CI: remove dead upload_pypi job from reusable workflow, rename to lib-build.yml#825

Draft
nikagra wants to merge 2 commits intoscylladb:masterfrom
nikagra:ci/drop-dead-upload-pypi-job
Draft

CI: remove dead upload_pypi job from reusable workflow, rename to lib-build.yml#825
nikagra wants to merge 2 commits intoscylladb:masterfrom
nikagra:ci/drop-dead-upload-pypi-job

Conversation

@nikagra
Copy link
Copy Markdown

@nikagra nikagra commented Apr 17, 2026

Summary

Closes #824. Follow-up to #820, addressing @Lorak-mmk's review concern.

The upload_pypi job in lib-build-and-push.yml was never reachable: none of the four caller workflows pass upload: true. build-push.yml and publish-manually.yml already publish from their own separate jobs — this is required by how PyPI Trusted Publishing works: the OIDC token embeds the caller workflow path, so the pypa/gh-action-pypi-publish action must run in the caller, not inside a reusable workflow (see pypa/gh-action-pypi-publish#166).

Because the reusable workflow declared permissions: id-token: write for upload_pypi, GitHub's static permission validation (which runs before evaluating any if: conditions) forced build-test.yml — a pull_request workflow, where id-token defaults to none — to also declare id-token: write. This granted unnecessary privileges to a job that only builds wheels.

Changes

Commit 1: remove dead upload_pypi job, rename to lib-build.yml

  • Rename lib-build-and-push.ymllib-build.yml (it only builds now)
  • Remove upload input and upload_pypi job from the reusable workflow
  • Remove permissions: id-token: write and with: upload: false from build-test.yml — no longer needed, principle of least privilege restored
  • Update all callers (build-push.yml, publish-manually.yml, build-pre-release.yml) to reference the new workflow path and drop the now-nonexistent upload: false from with: blocks
  • Replace TODO comments in build-push.yml and publish-manually.yml: the separate publish job is now intentional design, not a temporary workaround pending an upstream fix

Commit 2: remove ineffective GITHUB_WORKFLOW_REF override

GITHUB_WORKFLOW_REF was set as a shell env var prefix on the cibuildwheel invocations, introduced in #439 as a workaround for the same issue #166. It does not work for two reasons:

  1. GITHUB_WORKFLOW_REF is set by GitHub's runner infrastructure to populate the OIDC token — overriding it in a child process's environment has no effect on the token GitHub's servers mint.
  2. The OIDC token is minted when pypa/gh-action-pypi-publish runs (in the publish job), not when cibuildwheel runs (in build-wheels). The variable was being set in the wrong job entirely.

The actual working workaround is already in place: pypa/gh-action-pypi-publish runs directly in the caller workflows (build-push.yml, publish-manually.yml). This variable override was dead code with no effect.

Result

Before After
build-test.yml permissions id-token: write (unnecessary) none (default, minimal)
lib-build-and-push.yml upload_pypi job Present but never runs Removed
Publish responsibility Dead code in reusable + real publish in callers Real publish in callers only
GITHUB_WORKFLOW_REF env var Set in cibuildwheel steps (no effect) Removed

…-build.yml

Closes scylladb#824. Follow-up to scylladb#820.

The upload_pypi job in lib-build-and-push.yml was never reachable: none of the
four caller workflows pass upload: true. build-push.yml and publish-manually.yml
already publish from their own separate jobs (necessary due to how PyPI Trusted
Publishing embeds the caller workflow path in the OIDC token).

Because the reusable workflow declared 'permissions: id-token: write' for
upload_pypi, GitHub's static permission validation forced build-test.yml (a
pull_request workflow, which defaults to id-token: none) to also declare
id-token: write — granting unnecessary privileges to a job that only builds
wheels.

Changes:
- Rename lib-build-and-push.yml -> lib-build.yml (it only builds now)
- Remove upload input and upload_pypi job from the reusable workflow
- Remove 'permissions: id-token: write' and 'with: upload: false' from
  build-test.yml (no longer needed)
- Update all callers (build-push.yml, publish-manually.yml, build-pre-release.yml)
  to reference the new workflow path and drop upload: false from with: blocks
- Replace TODO comments in build-push.yml and publish-manually.yml with an
  explanatory comment: the separate publish job is now intentional design,
  not a temporary workaround
@nikagra nikagra marked this pull request as draft April 17, 2026 09:25
… steps

GITHUB_WORKFLOW_REF was set as a shell env var prefix on the cibuildwheel
invocations as an attempted workaround for pypa/gh-action-pypi-publish#166
(reusable workflows not supported by PyPI Trusted Publishing).

The workaround does not work for two reasons:
1. GITHUB_WORKFLOW_REF is a GitHub runner-provided variable used to populate
   the OIDC token. Setting it in a child process's environment has no effect
   on the token GitHub's infrastructure mints.
2. The OIDC token is minted when pypa/gh-action-pypi-publish runs (in the
   publish job), not when cibuildwheel runs (in build-wheels). The variable
   was set in the wrong job entirely.

The actual working workaround is running pypa/gh-action-pypi-publish directly
in the caller workflow (build-push.yml, publish-manually.yml), which is already
done. This variable override is dead code with no effect.
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.

CI: remove dead upload_pypi job from reusable workflow and drop unnecessary id-token permission

1 participant