From 7c5afabd20ec5fc986651ad1768c21bea25f2dfd Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 10 Oct 2025 16:23:00 +0900 Subject: [PATCH] Make release process more robust (#51) * Remove debug `exit` * Add support for retrying in the target workflow detection --- Rakefile | 1 - helper.rb | 21 +++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 18216b7..8aecc39 100644 --- a/Rakefile +++ b/Rakefile @@ -104,7 +104,6 @@ namespace :release do task :ubuntu do current_version = Helper.detect_version Helper.wait_github_actions_workflow(current_version, "release.yaml") - exit ruby("-C", "packages", "-S", diff --git a/helper.rb b/helper.rb index bde8458..0f2f8bb 100644 --- a/helper.rb +++ b/helper.rb @@ -58,13 +58,22 @@ module Helper end def wait_github_actions_workflow(branch, workflow_file) - response = call_github_api("repos/#{github_repository}/actions/runs", - branch: branch) - run = response["workflow_runs"].find do |workflow_run| - workflow_run["path"] == ".github/workflows/#{workflow_file}" - end + run_id = nil + + 3.times do + response = call_github_api("repos/#{github_repository}/actions/runs", + branch: branch) + run = response["workflow_runs"].find do |workflow_run| + workflow_run["path"] == ".github/workflows/#{workflow_file}" + end + if run + run_id = run["id"] + break + end + sleep(60) + end + raise "Couldn't find target workflow" if run_id.nil? - run_id = run["id"] run_request_path = "repos/#{github_repository}/actions/runs/#{run_id}" loop do response = call_github_api(run_request_path)