From df558479e659f5ff2c66ec10a0abdb621e565b9f Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Thu, 16 Jun 2022 13:00:46 -0400 Subject: [PATCH 1/2] Fix bug in PR branch name --- .github/workflows/bump-api-schema-sha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-api-schema-sha.yml b/.github/workflows/bump-api-schema-sha.yml index fc390504f05135..900dbc7eb08602 100644 --- a/.github/workflows/bump-api-schema-sha.yml +++ b/.github/workflows/bump-api-schema-sha.yml @@ -20,12 +20,12 @@ jobs: run: | git config user.email "bot@getsentry.com" git config user.name "openapi-getsentry-bot" - git checkout -b "bot/bump-api-schema-to-${sha:0:8}" filepath="src/gatsby/utils/resolveOpenAPI.ts" sha="$(curl -sSL 'https://api.github.com/repos/getsentry/sentry-api-schema/commits/main' | awk 'BEGIN { RS=",|:{\n"; FS="\""; } $2 == "sha" { print $4 }')" sed -i -e 's|^const SENTRY_API_SCHEMA_SHA =.*$|const SENTRY_API_SCHEMA_SHA = "'$sha'"|g' "$filepath" + git checkout -b "bot/bump-api-schema-to-${sha:0:8}" git add "$filepath" git commit -m "Bump API schema to ${sha:0:8}" git push From b64a4c25ca5a9205f05a00d8102daf47a8a1cdba Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Thu, 16 Jun 2022 13:05:17 -0400 Subject: [PATCH 2/2] Explicate branch when pushing --- .github/workflows/bump-api-schema-sha.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-api-schema-sha.yml b/.github/workflows/bump-api-schema-sha.yml index 900dbc7eb08602..feb557065e366e 100644 --- a/.github/workflows/bump-api-schema-sha.yml +++ b/.github/workflows/bump-api-schema-sha.yml @@ -25,10 +25,11 @@ jobs: sha="$(curl -sSL 'https://api.github.com/repos/getsentry/sentry-api-schema/commits/main' | awk 'BEGIN { RS=",|:{\n"; FS="\""; } $2 == "sha" { print $4 }')" sed -i -e 's|^const SENTRY_API_SCHEMA_SHA =.*$|const SENTRY_API_SCHEMA_SHA = "'$sha'"|g' "$filepath" - git checkout -b "bot/bump-api-schema-to-${sha:0:8}" + branch="bot/bump-api-schema-to-${sha:0:8}" + git checkout -b "$branch" git add "$filepath" git commit -m "Bump API schema to ${sha:0:8}" - git push + git push --set-upstream origin "$branch" gh pr create --fill gh pr merge --squash