Skip to content

fix(ci): migrate publish-dev to OIDC Trusted Publishing#200

Merged
Dongbumlee merged 1 commit into
developfrom
fix/publish-dev-oidc
May 29, 2026
Merged

fix(ci): migrate publish-dev to OIDC Trusted Publishing#200
Dongbumlee merged 1 commit into
developfrom
fix/publish-dev-oidc

Conversation

@Dongbumlee
Copy link
Copy Markdown
Collaborator

Summary

Fixes the publish-dev job in ci.yml, which has been failing on every push to develop since the rebrand. Migrates from a non-existent API token to PyPI Trusted Publishing (OIDC) — the same pattern already used by staging.yml and release.yml.

Root cause

Failing run for reference: ci #26618715632

OpenID Connect token retrieval failed: GitHub: missing or insufficient
OIDC token permissions, the ACTIONS_ID_TOKEN_REQUEST_TOKEN environment
variable was unset
  • Job passed password: ${{ secrets.TEST_PYPI_TOKEN }} to pypa/gh-action-pypi-publish
  • TEST_PYPI_TOKEN secret was never configured in the staging environment (gh secret list --env staging shows only VSCE_PAT)
  • The action fell back to OIDC Trusted Publishing, which failed because the job had no permissions: id-token: write declaration
  • Even if the token existed, it would be scoped to the legacy agentops-toolkit project and wouldn't work for the rebranded agentops-accelerator

Change (11 +/1 -)

  1. Add job-level OIDC permission to publish-dev:
    permissions:
      id-token: write  # Required for PyPI Trusted Publishing (OIDC)
  2. Remove the password: line so pypa/gh-action-pypi-publish uses OIDC unambiguously.
  3. Document the Trusted Publishing setup in the workflow header, mirroring the pattern proven in staging.yml and release.yml.

verify-dev is unchanged — it only installs from public TestPyPI and never authenticates.

⚠️ Required actions BEFORE merging

Without these the first post-merge run will fail with not a trusted publisher or an environment-policy error (different failure mode than today's, but still broken):

  1. Register Trusted Publisher on TestPyPI at https://test.pypi.org/manage/project/agentops-accelerator/settings/publishing/

    • Owner: Azure
    • Repository: agentops
    • Workflow: ci.yml
    • Environment: staging

    This must be a separate entry from the existing workflow=staging.yml and workflow=release.yml publishers — TestPyPI matches the workflow filename exactly.

  2. Confirm staging GitHub Environment allows develop under Settings → Environments → staging → "Deployment branches and tags". publish-dev is the only consumer of staging triggered from a non-release/**/non-v* ref.

Validation

  • ✅ YAML parses cleanly (python3 -c "import yaml; yaml.safe_load(...)")
  • ✅ Zero TEST_PYPI_TOKEN references remain in .github/ (grep -rn TEST_PYPI_TOKEN .github/)
  • ✅ Pattern matches staging.yml:56-75 and release.yml:76-94 character-for-character
  • ✅ No collateral changes (only the 3 chunks in ci.yml)
  • ✅ Reviewed by Critic — CLEAN

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>
@Dongbumlee Dongbumlee merged commit 977edc3 into develop May 29, 2026
12 checks passed
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.

1 participant