From 67230d6de543d66ff2b2838daad3eb38fa0e9cb9 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 8 Nov 2022 12:45:25 -0700 Subject: [PATCH] fix: re-add ability to change the max fetch depth --- action.yml | 5 +++++ diff-sha.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 84611d31..1f1b9475 100644 --- a/action.yml +++ b/action.yml @@ -81,6 +81,10 @@ inputs: description: "Limit depth of the branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history." required: false default: "40" + max_fetch_depth: + description: "Maximum depth of the branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history." + required: false + default: "5000" since_last_remote_commit: description: "Use the last commit on the remote branch as the `base_sha`. Defaults to the last non merge commit on the target branch for pull request events and the previous commit of the current branch for push events." required: true @@ -177,6 +181,7 @@ runs: INPUT_UNTIL: ${{ inputs.until }} INPUT_PATH: ${{ inputs.path }} INPUT_FETCH_DEPTH: ${{ inputs.fetch_depth }} + INPUT_MAX_FETCH_DEPTH: ${{ inputs.max_fetch_depth }} INPUT_SINCE_LAST_REMOTE_COMMIT: ${{ inputs.since_last_remote_commit }} - name: Glob match uses: tj-actions/glob@v16 diff --git a/diff-sha.sh b/diff-sha.sh index aafddb34..3c1762a5 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -159,7 +159,7 @@ else # shellcheck disable=SC2086 git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" HEAD; depth=$((depth * 10)) - max_depth=5000 + max_depth=$INPUT_MAX_FETCH_DEPTH if [[ $depth -gt $max_depth ]]; then echo "::error::Unable to find merge-base between $TARGET_BRANCH and HEAD."