From db4f7e7890aeab3037e6bbc13d996db96bbad904 Mon Sep 17 00:00:00 2001 From: Daniel Azuma Date: Wed, 24 Jul 2024 22:35:21 +0000 Subject: [PATCH] chore: do not attempt to automerge generation PRs if there is no approval token --- .toys/generate-updates.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.toys/generate-updates.rb b/.toys/generate-updates.rb index 46720c9a284..48e9975d69d 100644 --- a/.toys/generate-updates.rb +++ b/.toys/generate-updates.rb @@ -85,12 +85,13 @@ def pr_single_gem api, version, index, total puts "(#{index}/#{total}) Pull request already exists for google-apis-#{api}_#{version}", :yellow return end - approval_message = "Rubber-stamped client auto-generation!" + approval_message = approval_token ? "Rubber-stamped client auto-generation!" : nil + labels = approval_token ? ["automerge"] : nil result = yoshi_pr_generator.capture enabled: !git_remote.nil?, remote: git_remote, branch_name: branch_name, commit_message: commit_message, - labels: ["automerge"], + labels: labels, auto_approve: approval_message, approval_token: approval_token do regen_single_gem api, version @@ -115,12 +116,13 @@ def pr_clean_old_gems puts "Pull request already exists for cleaning obsolete gems", :yellow return end - approval_message = "Rubber-stamped cleanup of obsolete gems!" + approval_message = approval_token ? "Rubber-stamped cleanup of obsolete gems!" : nil + labels = approval_token ? ["automerge"] : nil result = yoshi_pr_generator.capture enabled: !git_remote.nil?, remote: git_remote, branch_name: branch_name, commit_message: commit_message, - labels: ["automerge"], + labels: labels, auto_approve: approval_message, approval_token: approval_token do clean_old_gems