Skip to content

Commit 757dc3a

Browse files
committed
fix: resolve GITHUB_OUTPUT format error and suppress telemetry warning
- Fix grep -c pattern that caused "Invalid format '0'" error when no matches found. grep -c exits with code 1 on zero matches, causing the || fallback to run and produce multiline output "0\n0" - Add DISABLE_TELEMETRY=true env var to suppress telemetry warning in CI
1 parent 1638bd2 commit 757dc3a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/nuke-account.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
- run: go mod download
6262
- name: Nuke global resources
6363
id: nuke
64+
env:
65+
DISABLE_TELEMETRY: true
6466
run: |
6567
set +e
6668
go run -ldflags="-X 'main.VERSION=${{ github.sha }}'" main.go aws \
@@ -69,8 +71,8 @@ jobs:
6971
--delete-unaliased-kms-keys --log-level info 2>&1 | tee /tmp/nuke-global.log
7072
EXIT_CODE=${PIPESTATUS[0]}
7173
72-
DELETED=$(grep -c "\[Deleted\]" /tmp/nuke-global.log || echo "0")
73-
ERRORS=$(grep -c "\[Failed\]" /tmp/nuke-global.log || echo "0")
74+
DELETED=$(grep -c "\[Deleted\]" /tmp/nuke-global.log 2>/dev/null) || DELETED=0
75+
ERRORS=$(grep -c "\[Failed\]" /tmp/nuke-global.log 2>/dev/null) || ERRORS=0
7476
echo "deleted_count=${DELETED}" >> $GITHUB_OUTPUT
7577
echo "error_count=${ERRORS}" >> $GITHUB_OUTPUT
7678
@@ -131,6 +133,8 @@ jobs:
131133
- run: go mod download
132134
- name: Nuke ${{ matrix.region }}
133135
id: nuke
136+
env:
137+
DISABLE_TELEMETRY: true
134138
run: |
135139
set +e
136140
go run -ldflags="-X 'main.VERSION=${{ github.sha }}'" main.go aws \
@@ -139,8 +143,8 @@ jobs:
139143
--delete-unaliased-kms-keys --log-level info 2>&1 | tee /tmp/nuke-${{ matrix.region }}.log
140144
EXIT_CODE=${PIPESTATUS[0]}
141145
142-
DELETED=$(grep -c "\[Deleted\]" /tmp/nuke-${{ matrix.region }}.log || echo "0")
143-
ERRORS=$(grep -c "\[Failed\]" /tmp/nuke-${{ matrix.region }}.log || echo "0")
146+
DELETED=$(grep -c "\[Deleted\]" /tmp/nuke-${{ matrix.region }}.log 2>/dev/null) || DELETED=0
147+
ERRORS=$(grep -c "\[Failed\]" /tmp/nuke-${{ matrix.region }}.log 2>/dev/null) || ERRORS=0
144148
echo "deleted_count=${DELETED}" >> $GITHUB_OUTPUT
145149
echo "error_count=${ERRORS}" >> $GITHUB_OUTPUT
146150

0 commit comments

Comments
 (0)