Skip to content

Commit c19dcdc

Browse files
avtikhonkyukhin
authored andcommitted
github-ci: fix message send on rhel/fedora hosts
Found that on self-hosted runners where CentOS 7 is the base OS, 'send-telegram-notify' action creates message with syntax error: --------------'\n't'\n'```'\n'')) ; \ ^ SyntaxError: unexpected character after line continuation character It happened because of extra quotes at '\n' while it had to be \n. To avoid of it the same message changes must be done as for OSX hosts are doing. These changes should be done when self-hosted runners uses RHEL or Fedora as base OS.
1 parent 432edce commit c19dcdc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/actions/send-telegram-notify/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ runs:
2828
uname -s | tee -a $GITHUB_ENV
2929
echo 'EOF' >> $GITHUB_ENV
3030
shell: bash
31+
# check if host OS is rhel or fedora
32+
- run: |
33+
echo 'OS_IS_FEDORA_OR_RHEL<<EOF' >> $GITHUB_ENV
34+
grep "^ID=" /etc/os-release | grep -e 'centos' -e 'fedora' && echo true | tee -a $GITHUB_ENV
35+
echo 'EOF' >> $GITHUB_ENV
36+
shell: bash
3137
# get job id number
3238
- run: |
3339
sudo -n apt update -y ||:
@@ -53,7 +59,7 @@ runs:
5359
run: |
5460
# convert message from multi lines to single line and
5561
# add backslashes to single quote marks in message
56-
if ${{ env.KERNEL_NAME == 'Darwin' }} ; then
62+
if ${{ env.OS_IS_FEDORA_OR_RHEL == 'true' }} || ${{ env.KERNEL_NAME == 'Darwin' }} ; then
5763
msg="${MSG//$'\n'/\n}"
5864
msg="${msg//$'\\\''/\'}"
5965
else

0 commit comments

Comments
 (0)