From a35e2b0c54685a70eb94332260fa4a7194e2ffe5 Mon Sep 17 00:00:00 2001 From: Nadav Erell Date: Mon, 27 Oct 2025 23:19:43 +0200 Subject: [PATCH] fix: properly replace key-only lines in env files Previously, key-only lines (e.g., "SENTRY_RELEASE" without "=") were not detected as existing entries, causing duplicates when patching. Now correctly matches and replaces both "KEY=value" and key-only "KEY" lines (with optional trailing whitespace) to prevent duplication. --- .github/workflows/test.yml | 63 ++++++++++++++++++++++++++++++++++++-- action.yml | 5 +-- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aecbca9..06db624 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -165,7 +165,7 @@ jobs: - name: Verify output run: | echo "Updated files: ${{ steps.patch.outputs.updated_files }}" - + # Output should contain both files if [[ "${{ steps.patch.outputs.updated_files }}" == *"app1/.env"* ]] && \ [[ "${{ steps.patch.outputs.updated_files }}" == *"app2/.env"* ]]; then @@ -173,4 +173,63 @@ jobs: else echo "Error: Output doesn't contain expected files" exit 1 - fi \ No newline at end of file + fi + + test-key-only-lines: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create env file with key-only lines + run: | + mkdir -p test + cat > test/.env <