Skip to content

Commit

Permalink
Merge pull request #654 from tj-actions/chore/add-back-ability-to-fet…
Browse files Browse the repository at this point in the history
…ch-branch-history
  • Loading branch information
jackton1 committed Sep 29, 2022
2 parents 3b54ee8 + 1b43849 commit 528984a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/test.yml
Expand Up @@ -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: |
Expand Down
3 changes: 3 additions & 0 deletions diff-sha.sh
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 528984a

Please sign in to comment.