From 2c7cd91cbcc1e250631a9ee1c23670c467613e97 Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:22:07 +0100 Subject: [PATCH] Fix default branch name bit of update workflow (#189) --- .github/workflows/commit.py | 8 ++++---- .github/workflows/flake_update.yaml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commit.py b/.github/workflows/commit.py index ec076c8..4489787 100755 --- a/.github/workflows/commit.py +++ b/.github/workflows/commit.py @@ -21,9 +21,9 @@ if not GITHUB_TOKEN: REPO = os.environ.get("GITHUB_REPOSITORY") if not REPO: raise Exception("Supply GITHUB_REPOSITORY env var") -GITHUB_BASE_REF = os.environ.get("GITHUB_BASE_REF") or "" -if not GITHUB_BASE_REF: - raise Exception("Supply GITHUB_BASE_REF env var") +DEFAULT_BRANCH = os.environ.get("DEFAULT_BRANCH") or "" +if not DEFAULT_BRANCH: + raise Exception("Supply DEFAULT_BRANCH env var") GITHUB_OUTPUT = os.environ.get("GITHUB_OUTPUT") or "" if not GITHUB_OUTPUT: raise Exception("Supply GITHUB_OUTPUT env var") @@ -155,7 +155,7 @@ def main(): create_branch(branch_name, new_commit_sha) print(f"Branch created: {branch_name}") - url, pr_num = create_pull_request(title="Upgrade Nix flake and deps", branch_name=branch_name, base_branch=GITHUB_BASE_REF) + url, pr_num = create_pull_request(title="Upgrade Nix flake and deps", branch_name=branch_name, base_branch=DEFAULT_BRANCH) print(f"See PR at: {url}") with open(GITHUB_OUTPUT, "a") as output_file: diff --git a/.github/workflows/flake_update.yaml b/.github/workflows/flake_update.yaml index cd819ed..9f5f859 100644 --- a/.github/workflows/flake_update.yaml +++ b/.github/workflows/flake_update.yaml @@ -46,6 +46,7 @@ jobs: - name: Create pull request env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} BEARER_TOKEN: ${{ steps.generate-token.outputs.token }} run: /tmp/venv/bin/python .github/workflows/commit.py