Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(notifications): Fix extraction of last 2K chars #9450

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions .github/workflows/_test_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,8 @@ jobs:
) 2> >(tee err.log)

EXIT_CODE=$?
# Slack only allows 3000 chars per block.
# Since a block contains information about other
# metdata than the log, we prune the log to 2000
# chars.
min() {
if (( $1 > $2 )); then
echo $2
else
echo $1
fi
}

log=$(cat err.log)

MAX_LENGTH=$(echo $log | wc -m)
MAX_LENGTH=$(min $MAX_LENGTH 2000)
MAX_LENGTH=$(( $MAX_LENGTH - 1 ))

log=$(echo "${log: -${MAX_LENGTH}}" | base64 -w 0)
echo "log=$log" | tee -a "$GITHUB_OUTPUT"

echo "log=$(tail -c 2000 err.log | base64 -w 0)" >> "$GITHUB_OUTPUT"

exit $EXIT_CODE

Expand Down
Loading