From 5b87bfbbbfc5c590817f6657b377489819acbcaa Mon Sep 17 00:00:00 2001 From: erikn69 Date: Mon, 27 Jan 2025 09:44:41 -0500 Subject: [PATCH] Support onlyDiff=true --- entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 9a8c50f..d47fa8a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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