Skip to content

Commit 6df5d24

Browse files
committed
Tighten CI workflow assertions and use exit code for install detection
- Use grep -Fq with specific strings instead of broad pattern matches - Use install command exit code instead of grepping for "Installation successful" to determine if chromium was installed - Remove || true from quarto check install (no reason to suppress) - Use set +e/set -e to capture exit codes without swallowing errors
1 parent 12eb575 commit 6df5d24

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/test-install.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,15 @@ jobs:
7676
id: install-chromium
7777
shell: bash
7878
run: |
79-
output=$(quarto install chromium --no-prompt 2>&1) || true
79+
set +e
80+
output=$(quarto install chromium --no-prompt 2>&1)
81+
exit_code=$?
82+
set -e
8083
echo "$output"
81-
if echo "$output" | grep -q "deprecated"; then
84+
if echo "$output" | grep -Fq "is deprecated"; then
8285
echo "deprecation-warning=true" >> "$GITHUB_OUTPUT"
8386
fi
84-
if echo "$output" | grep -q "Installation successful"; then
87+
if [ "$exit_code" -eq 0 ]; then
8588
echo "chromium-installed=true" >> "$GITHUB_OUTPUT"
8689
fi
8790
@@ -96,9 +99,11 @@ jobs:
9699
id: update-chromium
97100
shell: bash
98101
run: |
99-
output=$(quarto update chromium --no-prompt 2>&1) || true
102+
set +e
103+
output=$(quarto update chromium --no-prompt 2>&1)
104+
set -e
100105
echo "$output"
101-
if echo "$output" | grep -q "deprecated"; then
106+
if echo "$output" | grep -Fq "is deprecated"; then
102107
echo "deprecation-warning=true" >> "$GITHUB_OUTPUT"
103108
fi
104109
@@ -113,9 +118,9 @@ jobs:
113118
if: steps.install-chromium.outputs.chromium-installed == 'true'
114119
shell: bash
115120
run: |
116-
output=$(quarto check install 2>&1) || true
121+
output=$(quarto check install 2>&1)
117122
echo "$output"
118-
if ! echo "$output" | grep -q "outdated"; then
123+
if ! echo "$output" | grep -Fq "Chromium is outdated"; then
119124
echo "::error::Outdated Chromium warning missing from quarto check"
120125
exit 1
121126
fi

0 commit comments

Comments
 (0)