Skip to content

Commit 5442745

Browse files
authored
Wait for some time between creating the release PR and searching for it (#56)
1 parent ea38cc5 commit 5442745

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

exe/create-github-release

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33

44
require 'create_github_release'
55

6+
# Call method up to max_attempts times until it returns a non-nil value
7+
#
8+
# @param method [Proc] the method to call
9+
# @param max_attempts [Integer] the maximum number of attempts to make
10+
# @param sleep_time [Float] the number of seconds to sleep between attempts
11+
#
12+
# @return [Object] the result of the method call or nil
13+
#
14+
# @api public
15+
#
16+
def wait_for_non_nil(method, max_attempts: 10, sleep_time: 0.5)
17+
result = nil
18+
19+
max_attempts.times do |n|
20+
sleep sleep_time unless n.zero?
21+
22+
break if (result = method.call)
23+
end
24+
25+
result
26+
end
27+
628
options = CreateGithubRelease::CommandLine::Parser.new.parse(*ARGV)
729
pp options if options.verbose
830

@@ -23,7 +45,7 @@ puts <<~MESSAGE unless project.quiet
2345
2446
* Get someone to review and approve the release pull request:
2547
26-
#{project.release_pr_url}
48+
#{wait_for_non_nil(-> { project.release_pr_url }, max_attempts: 10, sleep_time: 0.5)}
2749
2850
* Merge the pull request manually from the command line with the following
2951
commands:

0 commit comments

Comments
 (0)