Skip to content

fix(stac_cli): Update workflow to fix Missing required environment variable: STAC_BASE_API_URL.#465

Merged
divyanshub024 merged 4 commits intodevfrom
dv/stac_cli-1.6
Mar 4, 2026
Merged

fix(stac_cli): Update workflow to fix Missing required environment variable: STAC_BASE_API_URL.#465
divyanshub024 merged 4 commits intodevfrom
dv/stac_cli-1.6

Conversation

@divyanshub024
Copy link
Member

@divyanshub024 divyanshub024 commented Mar 3, 2026

Update workflow to fix Missing required environment variable: STAC_BASE_API_URL.

Summary by CodeRabbit

  • Chores

    • Released version 1.5.1.
    • Improved environment variable handling with compile-time and runtime priority resolution.
    • Propagated required secrets into the build environment.
  • Bug Fixes

    • Added preflight secret validation to abort when required secrets are missing (Linux/macOS and Windows).
    • Fixed Windows build invocation and messaging to ensure consistent behavior and clearer release output.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5c190cce-841b-40c2-8fd0-25ed2ed26c52

📥 Commits

Reviewing files that changed from the base of the PR and between 34d8878 and 0aa06d0.

📒 Files selected for processing (1)
  • .github/workflows/stac_cli_release.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/stac_cli_release.yml

📝 Walkthrough

Walkthrough

Adds compile-time environment variable resolution to the CLI config and updates the GitHub Actions release workflow to validate secrets, expose them as environment variables, and pass them to the Dart compiler as -D defines; bumps package version 1.5.0 → 1.5.1.

Changes

Cohort / File(s) Summary
Release Workflow Configuration
.github/workflows/stac_cli_release.yml
Adds secret presence checks for Linux/macOS and Windows paths, exports four secrets into the Dart build step, passes them as -D compile-time defines, changes Windows compile command formatting, and adjusts release messaging.
Environment Configuration
packages/stac_cli/lib/src/config/env.dart
Adds _compiledEnvMap using String.fromEnvironment and updates _env resolution order: compile-time → runtime env → default → throw. Public API unchanged.
Version Files
packages/stac_cli/lib/src/version.dart, packages/stac_cli/pubspec.yaml
Bumps package version from 1.5.0 to 1.5.1.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant Build as Dart Compiler (build)
    participant Config as Env config
    participant Runtime as Runtime env (Platform.environment)
    GH->>GH: Validate required secrets (Linux/macOS & Windows)
    GH->>Build: Export secrets as ENV vars\nPass `-Dkey=value` defines to compiler
    Build->>Config: Compile-time: String.fromEnvironment reads -D defines
    Runtime->>Config: Runtime env available via Platform.environment
    Config->>Config: Resolve value: compile-time → runtime → default → error
    Config-->>Build: Provide resolved config values (at runtime or compiled-in)
    GH->>GH: Adjust release messaging based on tag existence
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Potatomonsta

Poem

🐰 I hopped through secrets, neat and spry,

Passed to build where compile-times lie.
Fallbacks hum from runtime's lair,
Version nudged with thoughtful care.
A tiny patch — a celebratory hop! 🥕🐇

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: adding preflight secret validation and passing secrets via environment variables to fix missing required environment variables in the workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dv/stac_cli-1.6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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/stac_cli_release.yml:
- Around line 88-92: Add explicit preflight checks that fail the job if any
required secret is empty before running the `dart compile` step; validate
STAC_BASE_API_URL, STAC_GOOGLE_CLIENT_ID, STAC_GOOGLE_CLIENT_SECRET, and
STAC_FIREBASE_API_KEY and abort with a clear error (echo + exit 1) when any
resolves to an empty string, and add the same guard in both OS paths that run
`dart compile` so the workflow cannot produce a broken binary.

In `@packages/stac_cli/lib/src/config/env.dart`:
- Around line 38-45: The _compiledEnvMap currently includes
STAC_GOOGLE_CLIENT_SECRET using String.fromEnvironment, which embeds the secret
into compiled binaries; remove STAC_GOOGLE_CLIENT_SECRET from _compiledEnvMap
and stop using String.fromEnvironment for that key, and instead load the secret
at runtime (e.g., via Platform.environment or the existing runtime env resolver)
or keep it server-side; update any code that reads _compiledEnvMap (references
to _compiledEnvMap or direct uses of STAC_GOOGLE_CLIENT_SECRET) to fetch the
secret through the runtime-only mechanism so it is not compiled into the binary.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27d5614 and 34d8878.

⛔ Files ignored due to path filters (4)
  • examples/counter_example/pubspec.lock is excluded by !**/*.lock
  • examples/movie_app/pubspec.lock is excluded by !**/*.lock
  • examples/stac_gallery/pubspec.lock is excluded by !**/*.lock
  • packages/stac_cli/pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/stac_cli_release.yml
  • packages/stac_cli/lib/src/config/env.dart
  • packages/stac_cli/lib/src/version.dart
  • packages/stac_cli/pubspec.yaml

…rkflow and pass them via environment variables for compilation.
@divyanshub024 divyanshub024 merged commit 4bb208d into dev Mar 4, 2026
7 of 8 checks passed
@divyanshub024 divyanshub024 deleted the dv/stac_cli-1.6 branch March 4, 2026 07:16
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