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

Commit d4acf4a

Browse files
mairasclaude
andauthored
fix(ci): handle grep exit code 1 when .env contains only comments (#43)
The _export_unset function was failing in CI because grep -v '^#' returns exit code 1 when no lines match (file contains only comments). With set -o errexit, this caused the script to exit immediately. The CI workflow creates .env with just a comment line: # Environment file for GitHub Actions When _export_unset tries to grep out comments, no lines match, and grep exits with code 1, terminating the script. Fix: Add || true to the grep command to ignore the no-match exit code. Also removed debug statements from the previous commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9413355 commit d4acf4a

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

run

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,14 @@ function build-deb {
9191

9292
# Set up environment
9393
dev-env
94-
echo "DEBUG: dev-env completed"
9594

9695
# Check if changelog was already generated by CI (shared-workflows)
9796
# If debian/changelog exists and was modified in the last 5 minutes, skip regeneration
98-
echo "DEBUG: Checking debian/changelog..."
99-
echo "DEBUG: PWD=$(pwd)"
100-
echo "DEBUG: ls -la debian/changelog: $(ls -la debian/changelog 2>&1 || echo 'file not found')"
101-
10297
if [ -f "debian/changelog" ]; then
103-
echo "DEBUG: debian/changelog exists, checking age..."
10498
# Use stat -c for Linux, stat -f for macOS, handle errors gracefully
10599
CHANGELOG_MTIME=$(stat -c %Y debian/changelog 2>/dev/null) || CHANGELOG_MTIME=$(stat -f %m debian/changelog 2>/dev/null) || CHANGELOG_MTIME=0
106-
echo "DEBUG: CHANGELOG_MTIME=$CHANGELOG_MTIME"
107100
CURRENT_TIME=$(date +%s)
108-
echo "DEBUG: CURRENT_TIME=$CURRENT_TIME"
109101
CHANGELOG_AGE=$((CURRENT_TIME - CHANGELOG_MTIME))
110-
echo "DEBUG: CHANGELOG_AGE=$CHANGELOG_AGE"
111102
if [ "$CHANGELOG_AGE" -lt 300 ]; then
112103
echo "📋 Using existing debian/changelog (generated by CI)"
113104
else
@@ -122,11 +113,8 @@ function build-deb {
122113
--force-distribution \
123114
"Automated release $PACKAGE_VERSION. See GitHub for details."
124115
fi
125-
else
126-
echo "DEBUG: debian/changelog does not exist"
127116
fi
128117

129-
echo "DEBUG: About to run dpkg-buildpackage..."
130118
dpkg-buildpackage -us -uc -b
131119

132120
echo "✅ Debian package built successfully"
@@ -427,7 +415,8 @@ function _export_unset {
427415

428416
# Need to use a temp file to avoid a subshell
429417
local tmpfile=$(mktemp)
430-
grep -v '^#' $file >$tmpfile
418+
# Use || true to handle files with only comments (grep returns 1 when no matches)
419+
grep -v '^#' "$file" >"$tmpfile" || true
431420

432421
while read -r line; do
433422
if [[ ! "$line" =~ ^[[:space:]]*$ ]]; then

0 commit comments

Comments
 (0)