File tree 2 files changed +6
-11
lines changed 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -83,22 +83,19 @@ jobs:
83
83
- name : extract the new tweet message
84
84
id : get-comment-body
85
85
run : |
86
- echo "${{github.event.comment.body}}" | sed '1 s/#tweet//' | sed '1 s/ //' > tweet.txt
87
- echo ::set-output name=tweet_length::$(cat tweet.txt | tr -d '\n\r%' | wc -c)
88
- sed 's/^/> /' tweet.txt > tweet_quote.txt
89
- # escape file content to preserve new lines
86
+ body=$( echo "${{github.event.comment.body}}" | sed '1 s/#tweet//' | sed '1 s/ //')
87
+ echo ::set-output name=tweet_length::$(echo $body | tr -d '\n\r%' | wc -c)
88
+ body_quote=$(echo $body | sed 's/^/> /')
89
+ # escape string content to preserve new lines
90
90
# (see example in https://github.com/peter-evans/create-or-update-comment)
91
- body=$(cat tweet.txt)
92
91
body="${body//'%'/'%25'}"
93
92
body="${body//$'\n'/'%0A'}"
94
93
body="${body//$'\r'/'%0D'}"
95
- echo ::set-output name=body::$body
96
- body_quote=$(cat tweet_quote.txt)
97
94
body_quote="${body_quote//'%'/'%25'}"
98
95
body_quote="${body_quote//$'\n'/'%0A'}"
99
96
body_quote="${body_quote//$'\r'/'%0D'}"
97
+ echo ::set-output name=body::$body
100
98
echo ::set-output name=body_quote::$body_quote
101
- rm tweet.txt tweet_quote.txt
102
99
- name : print new tweet CI message in a new comment
103
100
uses : peter-evans/create-or-update-comment@v1
104
101
with :
Original file line number Diff line number Diff line change @@ -22,15 +22,13 @@ jobs:
22
22
id : extract-tweet
23
23
if : ${{steps.fc.outputs.comment-id != null}}
24
24
run : |
25
- echo "${{steps.fc.outputs.comment-body}}" | sed '1d' | sed 's/> //' > tweet.txt
25
+ body=$( echo "${{steps.fc.outputs.comment-body}}" | sed '1d' | sed 's/> //')
26
26
# escape file content to preserve new lines
27
27
# (see example in https://github.com/peter-evans/create-or-update-comment)
28
- body=$(cat tweet.txt)
29
28
body="${body//'%'/'%25'}"
30
29
body="${body//$'\n'/'%0A'}"
31
30
body="${body//$'\r'/'%0D'}"
32
31
echo ::set-output name=body::$body
33
- rm tweet.txt
34
32
- name : tweet the message
35
33
if : ${{steps.fc.outputs.comment-id != null}}
36
34
uses : ethomson/send-tweet-action@v1
You can’t perform that action at this time.
0 commit comments