Infisical CLI version resolution: fallback when asset is missing +semver: minor#157
Infisical CLI version resolution: fallback when asset is missing +semver: minor#157
Conversation
Update action.yml +semver: minor
Reviewer's GuideUpdates the Infisical GitHub Action’s CLI version resolution logic to iterate through candidate releases and ensure the expected architecture-specific asset exists before selecting a version, improving robustness and logging when releases are missing assets. Flow diagram for updated Infisical CLI version resolution logicflowchart TD
Start([Start version resolution]) --> FetchJSON
FetchJSON["Fetch releases JSON from GitHub API"] --> CheckFetch
CheckFetch{Fetch successful?} -->|No| FailFetch
CheckFetch -->|Yes| InitVars
FailFetch["Mark FETCH_FAILED=true and exit with error"]
InitVars["Set ARCH=linux_amd64, FOUND_VERSION=""", FOUND_TAG=""""] --> ListCandidates
ListCandidates["List candidate tag_names with jq (non-draft, non-prerelease, startswith v, no -postgres)"] --> ForEachTag
ForEachTag["Iterate over each TAG_NAME"] --> ExtractVersion
ExtractVersion["Derive VERSION by stripping v prefix from TAG_NAME"] --> BuildAsset
BuildAsset["Build ASSET=cli_${VERSION}_${ARCH}.tar.gz"] --> CheckAsset
CheckAsset["Use jq to check if release with TAG_NAME has ASSET in assets[]"] --> HasAsset
HasAsset{Asset present?} -->|Yes| SelectRelease
HasAsset -->|No| SkipRelease
SkipRelease["Log warning: Release TAG_NAME does not have ASSET, skipping"] --> NextTag
NextTag["Next TAG_NAME from candidate list"] --> ForEachTag
SelectRelease["Log success, set FOUND_VERSION=VERSION and FOUND_TAG=TAG_NAME"] --> DoneLoop
DoneLoop["Loop ends (either break on success or candidates exhausted)"] --> CheckFound
CheckFound{FOUND_VERSION and FOUND_TAG set?} -->|No| FailNoValid
CheckFound -->|Yes| Success
FailNoValid["Log error: No valid Infisical CLI release found with the expected asset; list available releases; set FETCH_FAILED=true and exit"]
Success["Log found version and tag; write version and tag_name to GITHUB_OUTPUT; set FETCH_FAILED=false"] --> End
End([End])
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Secrets | Mar 27, 2026 2:24p.m. | Review ↗ |
PR Review 🔍
|
PR Code Suggestions ✨
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The per-release asset check re-parses the full JSON with
jqon each iteration; consider restructuring to iterate once over.[]and check both the metadata criteria andassetsin a singlejqinvocation to avoid repeated scans. - The
jqexpression uses.assets[]which will error ifassetsis null or missing on a release; using.assets[]?or a safe fallback would make the asset existence check more robust to incomplete API responses.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The per-release asset check re-parses the full JSON with `jq` on each iteration; consider restructuring to iterate once over `.[]` and check both the metadata criteria and `assets` in a single `jq` invocation to avoid repeated scans.
- The `jq` expression uses `.assets[]` which will error if `assets` is null or missing on a release; using `.assets[]?` or a safe fallback would make the asset existence check more robust to incomplete API responses.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Infisical secrets check: ✅ No secrets leaked! 💻 Scan logs2026-03-27T14:42:02Z INF scanning for exposed secrets...
2:42PM INF 139 commits scanned.
2026-03-27T14:42:02Z INF scan completed in 24ms
2026-03-27T14:42:02Z INF no leaks found
|
🔍 Infisical CLI version resolution: fallback when asset is missing
Problem
Some Infisical CLI releases are published without the expected platform asset (e.g.
cli_0.43.66_linux_amd64.tar.gz). The previous implementation selected the first metadata-valid release (non-draft, non-prerelease, no-postgressuffix) but did not verify that the actual download asset was present in that release. This caused the workflow to fail at the download step with:Solution
Updated the
Get latest valid Infisical CLI versionstep to iterate through candidate releases in order and verify that the expected asset (cli_<version>_linux_amd64.tar.gz) is present in each release'sassetsarray before selecting it. The first release that satisfies both the metadata criteria and has the asset available is used.This validation is done entirely against the already-fetched API response — no extra HTTP requests are made per release, so there is no performance impact in the happy path.
Changes
jq+head -n1selection with an iteration loop over all candidate releasesjqon theassets[]array of each release⚠️ skippinglog line for observabilityARCHvariable for clarityExample log output (skipping a bad release)
Type of change
Summary by Sourcery
Ensure the GitHub Action selects an Infisical CLI release that actually includes the expected Linux AMD64 asset before proceeding.
Bug Fixes:
Enhancements: