3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-01-29 13:34:51 +00:00

fix: bug retrieving diff with custom a base sha (#945)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Tonye Jack 2023-01-11 13:58:50 -07:00 committed by GitHub
parent 988322a381
commit 487675b843
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 12 deletions

View file

@ -950,18 +950,6 @@ jobs:
fi
shell:
bash
- name: Run changed-files with custom sha
id: changed-files-custom-sha
if: github.event_name == 'pull_request' && github.event.action != 'closed'
uses: ./
with:
sha: ${{ github.event.pull_request.head.sha }}
- name: Show output
if: github.event.action != 'closed'
run: |
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
shell:
bash
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
@ -984,6 +972,31 @@ jobs:
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
shell:
bash
- name: Run changed-files with custom sha
id: changed-files-custom-sha
if: github.event_name == 'pull_request' && github.event.action != 'closed'
uses: ./
with:
sha: ${{ github.event.pull_request.head.sha }}
- name: Show output
if: github.event.action != 'closed'
run: |
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
shell:
bash
- name: Run changed-files with the pull request base sha and head sha
id: changed-files-pull-request-base-sha-head-sha
if: github.event_name == 'pull_request' && github.event.action != 'closed'
uses: ./
with:
base_sha: ${{ github.event.pull_request.base.sha }}
sha: ${{ github.event.pull_request.head.sha }}
- name: Show output
if: github.event.action != 'closed'
run: |
echo '${{ toJSON(steps.changed-files-pull-request-base-sha-head-sha.outputs) }}'
shell:
bash
- name: Run changed-files with specific files (only-changed)
id: changed-files-specific-only-changed
uses: ./

View file

@ -223,6 +223,10 @@ else
echo "::debug::Previous SHA: $PREVIOUS_SHA"
else
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
DIFF=".."
fi
fi
echo "::debug::Target branch: $TARGET_BRANCH"