File tree Expand file tree Collapse file tree 2 files changed +36
-5
lines changed Expand file tree Collapse file tree 2 files changed +36
-5
lines changed Original file line number Diff line number Diff line change 33
33
echo "PR_NUMBER=${{ github.event.pull_request.number || inputs.pr_number }}" >> $GITHUB_ENV
34
34
echo "PR_TITLE=${{ github.event.pull_request.title || inputs.pr_title }}" >> $GITHUB_ENV
35
35
36
- # So the "parse_title" script can be found?
36
+ # Ensure our scripts can be found when running the action
37
37
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action#creating-an-action-metadata-file
38
38
- run : echo "${{ github.action_path }}" >> $GITHUB_PATH
39
39
shell : bash
@@ -48,17 +48,17 @@ runs:
48
48
- name : Run gem install gem-compare
49
49
shell : bash
50
50
run : |
51
- gem install gem-compare --version ${{ inputs.gem_compare_version }}
51
+ with_retries gem install gem-compare --version ${{ inputs.gem_compare_version }}
52
52
53
53
- name : Run gem compare
54
54
shell : bash
55
55
run : |
56
- gem compare $COMPARE_GEM $COMPARE_FROM_VERSION $COMPARE_TO_VERSION > compare_output.txt
56
+ with_retries gem compare $COMPARE_GEM $COMPARE_FROM_VERSION $COMPARE_TO_VERSION > compare_output.txt
57
57
58
58
- name : Run gem compare --diff
59
59
shell : bash
60
60
run : |
61
- gem compare --diff $COMPARE_GEM $COMPARE_FROM_VERSION $COMPARE_TO_VERSION > compare_diff.txt
61
+ with_retries gem compare --diff $COMPARE_GEM $COMPARE_FROM_VERSION $COMPARE_TO_VERSION > compare_diff.txt
62
62
63
63
- name : Run gh pr comment
64
64
shell : bash
80
80
echo '````' >> comment2.txt
81
81
echo '</Details>' >> comment2.txt
82
82
83
- gh pr comment $PR_NUMBER --body-file comment1.txt --repo ${{ github.repository }}
83
+ with_retries gh pr comment $PR_NUMBER --body-file comment1.txt --repo ${{ github.repository }}
84
84
gh pr comment $PR_NUMBER --body-file comment2.txt --repo ${{ github.repository }} || true
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Modified version of travis_retry
4
+ # https://github.com/travis-ci/travis-build/blob/04a1963de816b8618bb3d7e2e22d873f05ab4091/lib/travis/build/bash/travis_retry.bash
5
+
6
+ SLEEP_SECONDS=5
7
+ RETRY_COUNT=5
8
+
9
+ retry_command () {
10
+ local result=0
11
+ local count=1
12
+ while [[ " ${count} " -le $RETRY_COUNT ]]; do
13
+ [[ " ${result} " -ne 0 ]] && {
14
+ echo -e " \\ n${ANSI_RED} The command \" ${* } \" failed. Retrying, ${count} of ${RETRY_COUNT} .${ANSI_RESET} \\ n" >&2
15
+ }
16
+ # run the command in a way that doesn't disable setting `errexit`
17
+ " ${@ } "
18
+ result=" ${?} "
19
+ if [[ $result -eq 0 ]]; then break ; fi
20
+ count=" $(( count + 1 )) "
21
+ sleep $SLEEP_SECONDS
22
+ done
23
+
24
+ [[ " ${count} " -gt ${RETRY_COUNT} ]] && {
25
+ echo -e " \\ n${ANSI_RED} The command \" ${* } \" failed ${RETRY_COUNT} times.${ANSI_RESET} \\ n" >&2
26
+ }
27
+
28
+ return " ${result} "
29
+ }
30
+
31
+ retry_command " $@ "
You can’t perform that action at this time.
0 commit comments