File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 33
44require '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+
628options = CreateGithubRelease ::CommandLine ::Parser . new . parse ( *ARGV )
729pp 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:
You can’t perform that action at this time.
0 commit comments