Skip to content

Commit

Permalink
fix: determine default_branch without a gh token
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Jan 22, 2024
1 parent 2b5fac1 commit 8bf416b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="red"

RUN apk add git
RUN wget https://github.com/cli/cli/releases/download/v2.42.1/gh_2.42.1_linux_amd64.tar.gz && \
tar -xvf gh_2.42.1_linux_amd64.tar.gz && \
mv gh_2.42.1_linux_amd64/bin/gh /usr/local/bin/gh && \
rm -rf gh_2.42.1_linux_amd64.tar.gz gh_2.42.1_linux_amd64

COPY LICENSE README.md /

Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

git config --global --add safe.directory '*'

DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)
DEFAULT_BRANCH=$(LC_ALL=C git remote show origin | sed -n '/HEAD branch/s/.*: //p')

# for reasons I can't explain, we still need to `git fetch` even with
# `fetch-depth: 0`. Perhaps fetch depth only grabs the history of the current
Expand Down

0 comments on commit 8bf416b

Please sign in to comment.