From 1b438493cf8d51977c29079025e9a06bf26ccaa3 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 28 Sep 2022 20:42:32 -0600 Subject: [PATCH] chore: add back ability to fetch branch history --- .github/workflows/test.yml | 7 ------- diff-sha.sh | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f21b9e0dd96..4c1126a28a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -136,14 +136,7 @@ jobs: - name: Run changed-files with a single commit history id: changed-files - continue-on-error: true uses: ./ - - - name: Exit with 1 if no error is raised - if: github.event_name == 'pull_request' && steps.changed-files.outcome != 'failure' - run: | - echo "Expected: (failure) got ${{ steps.changed-files.outcome }}" - exit 1 - name: Show output run: | diff --git a/diff-sha.sh b/diff-sha.sh index 36268db4a3c..551b5d13fe9 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -62,6 +62,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then CURRENT_BRANCH=$TARGET_BRANCH && exit_status=$? || exit_status=$? if [[ -z $INPUT_BASE_SHA ]]; then + git fetch --no-tags -u --progress origin --depth=2 "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? PREVIOUS_SHA="" if [[ "$GITHUB_EVENT_FORCED" == "false" ]]; then @@ -105,9 +106,11 @@ else echo "::debug::GITHUB_BASE_REF: $TARGET_BRANCH..." if [[ -z $INPUT_BASE_SHA ]]; then + git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? PREVIOUS_SHA=$GITHUB_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$? echo "::debug::Previous SHA: $PREVIOUS_SHA" else + git fetch --no-tags -u --progress origin --depth=1 "$(git rev-parse --verify "$INPUT_BASE_SHA")" && exit_status=$? || exit_status=$? PREVIOUS_SHA=$INPUT_BASE_SHA TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$? echo "::debug::Previous SHA: $PREVIOUS_SHA"