fix(ci): migrate publish-dev to OIDC Trusted Publishing#200
Merged
Conversation
The publish-dev job has been failing on every push to develop with
'OpenID Connect token retrieval failed: missing or insufficient OIDC
token permissions'.
Root cause:
- Job passed password: ${{ secrets.TEST_PYPI_TOKEN }} to
pypa/gh-action-pypi-publish
- TEST_PYPI_TOKEN secret was never configured in the staging environment
- The action fell back to OIDC Trusted Publishing, which failed because
the job had no 'permissions: id-token: write' declaration
Fix:
- Add job-level 'permissions: id-token: write' to publish-dev
- Remove the password: line so the action uses OIDC unambiguously
- Document the new Trusted Publisher setup steps in the workflow header,
mirroring the pattern proven in staging.yml and release.yml
Pre-merge operational prerequisites:
1. Register a Trusted Publisher on TestPyPI for this workflow:
https://test.pypi.org/manage/project/agentops-accelerator/settings/publishing/
owner=Azure, repo=agentops, workflow=ci.yml, environment=staging
(separate entry from the workflow=staging.yml / workflow=release.yml
publishers — TestPyPI matches workflow filename exactly).
2. Confirm the 'staging' GitHub Environment allows develop under
'Deployment branches and tags'.
Without these, the first post-merge run will fail with 'not a trusted
publisher' or environment-policy errors, not the current OIDC error.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
publish-devjob inci.yml, which has been failing on every push todevelopsince the rebrand. Migrates from a non-existent API token to PyPI Trusted Publishing (OIDC) — the same pattern already used bystaging.ymlandrelease.yml.Root cause
Failing run for reference: ci #26618715632
password: ${{ secrets.TEST_PYPI_TOKEN }}topypa/gh-action-pypi-publishTEST_PYPI_TOKENsecret was never configured in thestagingenvironment (gh secret list --env stagingshows onlyVSCE_PAT)permissions: id-token: writedeclarationagentops-toolkitproject and wouldn't work for the rebrandedagentops-acceleratorChange (11 +/1 -)
publish-dev:password:line sopypa/gh-action-pypi-publishuses OIDC unambiguously.staging.ymlandrelease.yml.verify-devis unchanged — it only installs from public TestPyPI and never authenticates.Without these the first post-merge run will fail with
not a trusted publisheror an environment-policy error (different failure mode than today's, but still broken):Register Trusted Publisher on TestPyPI at https://test.pypi.org/manage/project/agentops-accelerator/settings/publishing/
Azureagentopsci.ymlstagingThis must be a separate entry from the existing
workflow=staging.ymlandworkflow=release.ymlpublishers — TestPyPI matches the workflow filename exactly.Confirm
stagingGitHub Environment allowsdevelopunder Settings → Environments → staging → "Deployment branches and tags".publish-devis the only consumer ofstagingtriggered from a non-release/**/non-v*ref.Validation
python3 -c "import yaml; yaml.safe_load(...)")TEST_PYPI_TOKENreferences remain in.github/(grep -rn TEST_PYPI_TOKEN .github/)staging.yml:56-75andrelease.yml:76-94character-for-character