From 0a64fede773f464fba8e8b8602a0623e832d3176 Mon Sep 17 00:00:00 2001 From: Oliver Peate Date: Thu, 25 Mar 2021 12:56:14 +0000 Subject: [PATCH] Abort if steps fail in automated DB update --- bin/db_pull_request | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/db_pull_request b/bin/db_pull_request index 57c70b4..55bba04 100755 --- a/bin/db_pull_request +++ b/bin/db_pull_request @@ -11,10 +11,10 @@ end moment = Time.now.utc branch_name = "db-updates-#{moment.strftime("%Y%m%d%H%M%S")}" -system("git", "checkout", "-b", branch_name) +system("git", "checkout", "-b", branch_name) || abort("Unable to create branch") system("git", "add", "lib/db") system("git", "config", "--local", "user.email", "actions@github.com") system("git", "config", "--local", "user.name", "github-actions") -system("git", "commit", "-m", "DB updates #{moment.iso8601}") -system("git", "push", "-u", "origin", branch_name) -system("gh", "pr", "create", "--title", "DB updates #{moment.iso8601}", "--body", "From Github Actions") +system("git", "commit", "-m", "DB updates #{moment.iso8601}") || abort("Unable to commit changes") +system("git", "push", "-u", "origin", branch_name) || abort("Unable to push branch") +system("gh", "pr", "create", "--title", "DB updates #{moment.iso8601}", "--body", "From Github Actions") || abort("Unable to create PR")