fix: skip release finalize when app secrets unavailable#29
Conversation
📝 WalkthroughWalkthroughThe change adds a conditional gate to the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/release.yml:
- Line 280: The job-level if using secrets is invalid; create a preflight job
(e.g., check-release-secrets) that runs in a step which inspects both secrets
RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY and sets a job output like
release_creds_set='true' or 'false', then gate the finalize job using the
preflight output (e.g., if:
needs.check-release-secrets.outputs.release_creds_set == 'true') instead of
referencing secrets directly; update the job name referenced in the workflow
from finalize to use needs.check-release-secrets for the conditional.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f4b56e7d-92db-4ca9-966a-74c9f37e121a
📒 Files selected for processing (1)
.github/workflows/release.yml
| finalize: | ||
| name: Finalize release | ||
| needs: [preflight, release] | ||
| if: ${{ secrets.RELEASE_APP_ID != '' }} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify expression-context validity for this workflow.
# Expected (current): context error for `secrets` in jobs.<job_id>.if.
# Expected (after fix): no context-availability error on that line.
actionlint .github/workflows/release.ymlRepository: aaditagrawal/t3code
Length of output: 416
Line 280: secrets cannot be used in jobs.finalize.if, so this gate is invalid.
The secrets context is not available in job-level if conditions (only github, inputs, needs, and vars are allowed). This will fail workflow validation. Additionally, this condition only checks RELEASE_APP_ID but not RELEASE_APP_PRIVATE_KEY, so the finalize job can still fail if only the ID is present.
Suggested fix (gate via a preflight output that checks both secrets)
# preflight job
outputs:
version: ${{ steps.release_meta.outputs.version }}
tag: ${{ steps.release_meta.outputs.tag }}
is_prerelease: ${{ steps.release_meta.outputs.is_prerelease }}
make_latest: ${{ steps.release_meta.outputs.make_latest }}
ref: ${{ github.sha }}
+ has_release_app_secrets: ${{ steps.release_app_secrets.outputs.available }}
steps:
+ - id: release_app_secrets
+ name: Detect release app secrets
+ shell: bash
+ env:
+ RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }}
+ RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
+ run: |
+ if [[ -n "$RELEASE_APP_ID" && -n "$RELEASE_APP_PRIVATE_KEY" ]]; then
+ echo "available=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "available=false" >> "$GITHUB_OUTPUT"
+ fi
# finalize job
- if: ${{ secrets.RELEASE_APP_ID != '' }}
+ if: ${{ needs.preflight.outputs.has_release_app_secrets == 'true' }}🧰 Tools
🪛 actionlint (1.7.11)
[error] 280-280: context "secrets" is not allowed here. available contexts are "github", "inputs", "needs", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details
(expression)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/release.yml at line 280, The job-level if using secrets is
invalid; create a preflight job (e.g., check-release-secrets) that runs in a
step which inspects both secrets RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY and
sets a job output like release_creds_set='true' or 'false', then gate the
finalize job using the preflight output (e.g., if:
needs.check-release-secrets.outputs.release_creds_set == 'true') instead of
referencing secrets directly; update the job name referenced in the workflow
from finalize to use needs.check-release-secrets for the conditional.
Summary
The
finalizejob in the release workflow fails on forks becauseRELEASE_APP_IDandRELEASE_APP_PRIVATE_KEYsecrets don't exist. Adds a conditional to skip the job when the secret is empty.Test plan
Summary by CodeRabbit