From f7306ac218e74fb74db8b8e889e313d05cad809c Mon Sep 17 00:00:00 2001 From: JordonPhillips Date: Thu, 21 Nov 2024 18:22:35 +0100 Subject: [PATCH] Checkout base repo for changelog The changelog tool was checking out the branch repo. This was done to enable pushing, but since the tool no longer pushes, it's not necessary. --- .changes/tool/amend.py | 21 ++++++++++++++------- .github/workflows/changelog-ci.yml | 3 --- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.changes/tool/amend.py b/.changes/tool/amend.py index f1dd55d9dc2..32e023f79c5 100644 --- a/.changes/tool/amend.py +++ b/.changes/tool/amend.py @@ -71,13 +71,20 @@ def amend( def get_new_changes(base: str | None) -> dict[Path, Change]: base = base or os.environ.get("GITHUB_BASE_REF", "main") - print(f"Running a diff against base branch: {base}") - result = subprocess.run( - f"git diff origin/{base} --name-only", - check=True, - shell=True, - capture_output=True, - ) + print(f"Running a diff against base branch: `{base}`") + + try: + result = subprocess.run( + f"git diff --name-only origin/{base}", + check=True, + shell=True, + capture_output=True, + ) + except subprocess.CalledProcessError as e: + print(f"stdout: {e.stdout.decode("utf-8")}\n\nstderr: {e.stderr.decode("utf-i")}") + raise + + print(f"Changed files:\n{result.stdout.decode("utf-8")}") new_changes: dict[Path, Change] = {} for changed_file in result.stdout.decode("utf-8").splitlines(): diff --git a/.github/workflows/changelog-ci.yml b/.github/workflows/changelog-ci.yml index 61910ff6599..3f4ae8be61a 100644 --- a/.github/workflows/changelog-ci.yml +++ b/.github/workflows/changelog-ci.yml @@ -7,9 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/setup-python@v5 with: