forked from python/python-docs-pt-br
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepmsg.sh
More file actions
20 lines (17 loc) · 739 Bytes
/
prepmsg.sh
File metadata and controls
20 lines (17 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# Prepare message for Telegram notification
set -ex
[ $# -ne 2 ] && ( echo "Expected 1 input and 1 output files, got $#"; exit; )
[ ! -f $1 ] && ( echo "Input file $1 not found, skipping."; exit; )
[ -z "${GITHUB_REPOSITORY}" ] && (echo "GITHUB_REPOSITORY is empty."; exit 1;)
[ -z "${GITHUB_RUN_ID}" ] && (echo "GITHUB_RUN_ID is empty."; exit 1;)
[ -z "${GITHUB_JOB}" ] && (echo "GITHUB_JOB is empty."; exit 1;)
URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
echo "❌ *${GITHUB_JOB}* (ID [${GITHUB_RUN_ID}]($URL)):" > $2
echo "" >> $2
grep 'cpython/Doc/.*WARNING:' $1 | \
sed 's|.*/cpython/Doc|Doc|' | \
uniq | \
sed 's|^|```\n|;s|$|\n```\n|' \
>> $2
echo "" >> $2