chore: add back ability to fetch branch history

This commit is contained in:
Tonye Jack 2022-09-28 20:42:32 -06:00
parent 3b54ee8a34
commit 1b438493cf
2 changed files with 3 additions and 7 deletions

View File

@ -136,15 +136,8 @@ 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: |
echo '${{ toJSON(steps.changed-files.outputs) }}'

View File

@ -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"