feat(ci): add Test PyPI release workflow for splunk-ao-adk#53
feat(ci): add Test PyPI release workflow for splunk-ao-adk#53adityamehra wants to merge 4 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- Replace mutable action refs (v4, v5, v7, release/v1) with full commit SHAs to match the supply-chain convention established in ci-tests.yaml - Add PEP 440 version format validation in the Override version step so manual workflow_dispatch inputs are checked before any file is modified Co-authored-by: Cursor <cursoragent@cursor.com>
|
Applied the same changesets from PR #48 to this workflow: SHA pinning — All action references ( Version input validation — Added a |
- Fix regex to correctly accept rc, .dev, and .post PEP 440 forms - Add permissions: contents: read to the test and build jobs Co-authored-by: Cursor <cursoragent@cursor.com>
fercor-cisco
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-4-8). It may contain mistakes.
Verdict: request_changes — Unscoped pull_request trigger publishes a Test PyPI dev release on every PR in the monorepo, fork PRs will fail at the OIDC publish step, and re-runs collide on the version.
General Comments
- 🟠 major (design): This workflow triggers on
pull_requestwith nopaths:filter, so every PR in the monorepo — including PRs that only touch the rootsplunk-aopackage, docs, or other workflows — will run the test/build/publish jobs and push a0.1.0.dev<run_number>release to Test PyPI. Both existing workflows (ci-tests.yaml,ci-tests-splunk-ao-adk.yaml) scope theirpull_requesttriggers withpaths:. Recommend addingpaths: ['splunk-ao-adk/**', '.github/workflows/release-splunk-ao-adk-test.yaml']so only relevant PRs consume Test PyPI versions and CI minutes. The test job here also duplicates the tests already run byci-tests-splunk-ao-adk.yamlon adk PRs — consider whether the release workflow needs to re-run them. - 🟠 major (security): Publishing on
pull_requestinteracts badly with forks. This is a public repo with existing forks. For PRs from forks, GitHub grants a read-only token and does not issue an OIDCid-token, so thePublish to Test PyPIjob (which needsid-token: write) will fail — giving external contributors a permanently red CI check. It also means arbitrary PR-supplied code runs in the build job before the publish step. Consider whether Test PyPI publishing should happen on PR events at all, or only on push-to-main /workflow_dispatch, leaving plain test/build for PR validation. - 🟡 minor (design): No
concurrency:group is defined, unlikeci-tests.yamlandci-tests-splunk-ao-adk.yamlwhich both usegroup: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}withcancel-in-progress: true. Rapid consecutive PR pushes will run redundant publishes in parallel. Add a concurrency group for consistency and to avoid wasted publishes.
Follow-ups
Suggested follow-up work that could be tracked as Shortcut stories:
.github/workflows/release-splunk-ao-adk-test.yaml:93-96: The build step usespip install build+python -m buildagainst the setup-python interpreter, while the rest of the repo (test job, CI workflows) standardizes onuv. Consider usinguv buildfor tooling consistency, or at minimum pin thebuildversion rather than installing latest unpinned.
| - name: Publish to Test PyPI | ||
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 | ||
| with: | ||
| repository-url: https://test.pypi.org/legacy/ | ||
| verbose: true | ||
| print-hash: true |
There was a problem hiding this comment.
🟡 minor (bug): Test PyPI (like PyPI) rejects re-uploading a file for a version that already exists. The PR version is keyed on github.run_number, which stays constant across re-runs (only run_attempt changes). So re-running a failed/succeeded workflow run will fail the publish step with a 400 File already exists error. Add skip-existing: true to make re-runs idempotent.
| - name: Publish to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| verbose: true | |
| print-hash: true | |
| - name: Publish to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| skip-existing: true | |
| verbose: true | |
| print-hash: true |
🤖 Generated by Astra
| on: | ||
| pull_request: # Publishes a .dev pre-release on every PR push |
There was a problem hiding this comment.
🟠 major (design): The pull_request: trigger has no paths: filter. Scope it to the adk package (and this workflow file) so unrelated PRs don't publish dev releases to Test PyPI.
| on: | |
| pull_request: # Publishes a .dev pre-release on every PR push | |
| on: | |
| pull_request: # Publishes a .dev pre-release on every PR push | |
| paths: | |
| - 'splunk-ao-adk/**' | |
| - '.github/workflows/release-splunk-ao-adk-test.yaml' |
🤖 Generated by Astra
Summary
Adds
.github/workflows/release-splunk-ao-adk-test.yaml— a pipeline that builds and publishes thesplunk-ao-adkpackage to Test PyPI.How it works
0.1.0.dev<run_number>to Test PyPI — clean version (e.g.0.1.0) is never consumed and stays available for the real releaseworkflow_dispatchwith version: publishes the exact version suppliedworkflow_dispatchwithout version: publishes whatever is inpyproject.tomlas-isNotes
release-splunk-ao-adk-test.yaml, environment:testpypi)python -m build(hatchling backend)Made with Cursor