[WIP] Update GitHub Actions release workflow to fix token error#17
Merged
[WIP] Update GitHub Actions release workflow to fix token error#17
Conversation
Agent-Logs-Url: https://github.com/niwo/cloudstack_client/sessions/851023cb-6410-453d-b993-8afc5e4a1a44 Co-authored-by: niwo <57439+niwo@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.
.github/workflows/release.ymlfor permissions and publish step configurationcontents: read, keepid-token: write, and avoid job-level permission overridesrubygems/release-gem@v2and keep onlyapi-keyauth inputOriginal prompt
Update the GitHub Actions release workflow to resolve the 'Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable' error on publish. Specifically:
This will fix the workflow so the publish step can complete successfully using the secret RUBYGEMS_AUTH_TOKEN.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The job failed with the error: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable. This happens because the publish job tries to use OIDC-based authentication, but the current workflow permissions setting is too restrictive.
Solution:
In your .github/workflows/release.yml, update the permissions key to include id-token as follows:
yaml
permissions:
contents: read
id-token: write
Place this at the top level of your workflow, not just for individual jobs. This will allow GitHub Actions to issue the necessary OIDC token for publishing.
After making this change, your release workflow should be able to acquire the required environment variable and proceed with publishing.
User: I already have this setting
Assistant: Thank you for clarifying. Let's review the situation and recommend a more targeted solution.
Analysis
Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variableWhat Causes This Error?
This error typically means the job or step is trying to use OIDC for authentication (often for publishing or some form of deployment), but GitHub Actions can't provide the OIDC token. Even with permissions set, there are a few scenarios where this can still fail:
Specifics for Your Workflow
rubygems/release-gem@v1.${{ secrets.RUBYGEMS_AUTH_TOKEN }}, so OIDC is not strictly required unless you configured rubygems to use OIDC over API keys.What To Do
1. Check for Job-Level Permission Overrides
Ensure none of your jobs ("verify", "publish") have their own
permissions:block that conflicts with the top-level one.2. Try Pinning rubygems/release-gem to a Newer Version
It’s possible your version of
rubygems/release-gemis trying to use OIDC (which is opt-in and not default for most RubyGems flows), or the action has a bug.Try pinning to the latest version:
3. Remove the
audienceParameter if Not NeededYour log contains:
audience: rubygems.orgUnless you are configured for OIDC federation on RubyGems (which is not the default), omit this. RubyGems.org typically requires the API key, not OIDC.
4. Double-Check That You Are Using a GitHub-Hosted Runner
OIDC tokens are not available on self-hosted runners unless specifically enabled.
5. Fallback: Use an API key Only
If you don’t plan to use OIDC for RubyGems yet, you can force the action to use only your API key by setting only:
and omitting any OIDC/audience options.
Example: Minimal Working Publish Step
Make sure you do not set OIDC parameters unless explicitly required.
Summary:
Even with correct permissions, if the action or step requests an OIDC audience or expects OIDC, but RubyGems and your action setup are not actually using it, you will hit this error. Pinning the action, remov...
This pull request was created from Copilot chat.