Skip to content

Commit

Permalink
Support onlyDiff=true
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Jan 27, 2025
1 parent b7186f0 commit 5b87bfb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ if [[ "${INPUT_PRESET}" ]]; then
pint_command+=" --preset ${INPUT_PRESET}"
fi

if [[ "${INPUT_ONLYDIFF}" == true ]]; then
if [[ -n "${GITHUB_TOKEN}" ]]; then
INPUT_ONLYDIFF=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}" | jq -r .default_branch)
else
INPUT_ONLYDIFF=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
fi
fi

if [[ "${INPUT_ONLYDIFF}" ]]; then
pint_command+=" --diff=${INPUT_ONLYDIFF}"
INPUT_ONLYDIRTY=false
Expand Down

0 comments on commit 5b87bfb

Please # to comment.