Skip to content
This repository was archived by the owner on Feb 15, 2026. It is now read-only.

Comments

fix(ci): handle missing .env and .env.defaults in _env function#41

Merged
mairas merged 1 commit intomainfrom
fix/env-missing-files
Nov 21, 2025
Merged

fix(ci): handle missing .env and .env.defaults in _env function#41
mairas merged 1 commit intomainfrom
fix/env-missing-files

Conversation

@mairas
Copy link
Contributor

@mairas mairas commented Nov 21, 2025

Summary

  • Fix _env function crashing when neither .env nor .env.defaults exist
  • The function now continues gracefully in CI environments

Problem

The CI build was failing immediately after printing "🗝️ Setting environment from .env and .env.defaults" because:

  1. In CI, there's no .env file (it's gitignored)
  2. When .env doesn't exist, the code tried to cp .env.defaults .env
  3. But .env.defaults doesn't exist in the repository
  4. With set -o errexit, this caused the script to exit with code 1

Solution

Changed the _env function to:

  • Use elif [ -f .env.defaults ] instead of else to only attempt the copy if the source file exists
  • Continue gracefully when neither file exists (typical CI environment)

Test plan

  • PR checks pass (this is the actual fix for the failing workflow)

🤖 Generated with Claude Code

The _env function crashed in CI when neither .env nor .env.defaults
existed. The previous code unconditionally tried to copy .env.defaults
to .env when .env was missing, but .env.defaults doesn't exist in the
repository.

Changed the logic to:
- Only copy .env.defaults if it exists (elif instead of else)
- Continue gracefully when neither file exists (CI environment)

This fixes the build-deb step failure where the script exited with
code 1 immediately after printing "Setting environment from .env
and .env.defaults".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mairas mairas merged commit cb8eb78 into main Nov 21, 2025
1 check passed
@mairas mairas deleted the fix/env-missing-files branch November 21, 2025 23:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant