From 7b155b729d9244807b4832f7f5ee64c916779621 Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 5 Aug 2024 09:13:34 +0100 Subject: [PATCH] refactor branch exists to use gh cli --- .github/workflows/copy-content.yml | 4 +++- testFile.txt | 0 2 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 testFile.txt diff --git a/.github/workflows/copy-content.yml b/.github/workflows/copy-content.yml index c70c5698..c48f11d0 100644 --- a/.github/workflows/copy-content.yml +++ b/.github/workflows/copy-content.yml @@ -28,7 +28,9 @@ jobs: steps: - name: Check if existing tokens branch exists id: check_branch - run: echo "branch_exists=$(git ls-remote --heads https://github.com/${{ inputs.repo }}.git refs/heads/${{ inputs.branch }} | wc -l | xargs)" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ secrets.PAT }} + run: echo "branch_exists=$(gh api repos/${{ inputs.repo }}/branches/${{ inputs.branch }} --jq '.name' | wc -l | xargs)" >> $GITHUB_OUTPUT - name: Check if open PR exists id: check_pr env: diff --git a/testFile.txt b/testFile.txt deleted file mode 100644 index e69de29b..00000000