You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Add environment variable validation to opencode GitHub Action #57340
[FEATURE]: Add environment variable validation to opencode GitHub Action
I have verified this is not a duplicate
Description
The opencode GitHub Action should validate that required environment variables are properly set before running. Currently, if OPENCODE_API_KEY is missing or malformed, the action silently fails.
Proposed Solution
Add a validation step at the beginning of the action that:
Checks if OPENCODE_API_KEY is set and non-empty
Validates the key format (should start with a known prefix)
Tests connectivity to api.opencode.ai with the key
Reports the validation result in the issue comment for debugging
Something like:
- name: Validate environmentrun: | if [ -z "$OPENCODE_API_KEY" ]; then gh issue comment ${{ github.event.issue.number }} --body "❌ OPENCODE_API_KEY is not set" exit 1 fi # Report key metadata (not the key itself!) for debugging KEY_LEN=${#OPENCODE_API_KEY} KEY_PREFIX="${OPENCODE_API_KEY:0:8}" gh issue comment ${{ github.event.issue.number }} --body "✅ Environment validated: key_length=$KEY_LEN, prefix=$KEY_PREFIX..."
Why This Is Needed
In production CI/CD pipelines, silent failures waste developer time. A validation step would catch configuration issues immediately.
Alternatives Considered
Manually adding validation to each workflow (too much boilerplate)
Using a separate validation action (adds complexity)
Thanks for the suggestion. The request is for the opencode GitHub Action to check up front that OPENCODE_API_KEY is set, and to fail with a clear error instead of failing silently. Maintainers will consider it.
One note on the snippet: we wouldn't post anything derived from the key, including its length or prefix, in an issue comment. Issue comments are public, and even part of a secret shouldn't be exposed. Any validation would report only whether the key is present or valid, in the workflow log.
Activity
opencode-agent commentedon Oct 20, 2026
Thanks for the suggestion. The request is for the opencode GitHub Action to check up front that
OPENCODE_API_KEYis set, and to fail with a clear error instead of failing silently. Maintainers will consider it.One note on the snippet: we wouldn't post anything derived from the key, including its length or prefix, in an issue comment. Issue comments are public, and even part of a secret shouldn't be exposed. Any validation would report only whether the key is present or valid, in the workflow log.
Related: #57337, #57339.