bito-code-review[bot] commented on PR #44738:
URL: https://github.com/apache/superset/pull/44738#issuecomment-5864544508
<!-- Bito Reply -->
The flagged issue is correct. When `set -o pipefail` is enabled, `grep -q`
exiting early upon finding a match can cause the preceding `printf` command to
receive a SIGPIPE signal, which may lead to an incomplete execution of the
script if not handled. To resolve this, you can use `|| true` or redirect the
output to avoid the pipe failure, or simply use a temporary file to store the
list of files.
Here is a concise fix using `|| true` to prevent the script from aborting
due to the pipe failure:
```bash
if printf '%s
' "${files}" | grep -q '^superset-frontend/' || true; then
echo "needs_frontend=true" >> "$GITHUB_OUTPUT"
else
echo "needs_frontend=false" >> "$GITHUB_OUTPUT"
fi
# Matches oxlint-docs's own files: pattern in
.pre-commit-config.yaml
if printf '%s
' "${files}" | grep -qE '^docs/.*\.(js|jsx|ts|tsx)$' || true; then
echo "needs_docs=true" >> "$GITHUB_OUTPUT"
else
echo "needs_docs=false" >> "$GITHUB_OUTPUT"
fi
```
Would you like me to check and address the rest of the comments on this PR?
**.github/workflows/pre-commit.yml**
```
if printf '%s\n' "${files}" | grep -q '^superset-frontend/' || true; then
echo "needs_frontend=true" >> "$GITHUB_OUTPUT"
else
echo "needs_frontend=false" >> "$GITHUB_OUTPUT"
fi
# Matches oxlint-docs's own files: pattern in
.pre-commit-config.yaml
if printf '%s\n' "${files}" | grep -qE
'^docs/.*\.(js|jsx|ts|tsx)$' || true; then
echo "needs_docs=true" >> "$GITHUB_OUTPUT"
else
echo "needs_docs=false" >> "$GITHUB_OUTPUT"
fi
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]