fix: error retrieving changed files (#882)
This commit is contained in:
parent
a5b3ab3adf
commit
d2f7657e17
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 2
|
max-parallel: 2
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout into dir1
|
- name: Checkout into dir1
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -94,7 +94,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 2
|
max-parallel: 2
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-11, macos-latest, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
@ -149,7 +149,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
@ -184,7 +184,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
@ -212,7 +212,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
fetch-depth: [1, 2]
|
fetch-depth: [1, 2]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -238,7 +238,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
@ -290,7 +290,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, ubuntu-22.04, windows-latest, macos-latest, macos-11, windows-2022]
|
platform: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
@ -945,21 +945,21 @@ jobs:
|
|||||||
- name: Get branch name
|
- name: Get branch name
|
||||||
id: branch-name
|
id: branch-name
|
||||||
uses: tj-actions/branch-names@v6
|
uses: tj-actions/branch-names@v6
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request' && matrix.fetch-depth == 0
|
||||||
- uses: nrwl/nx-set-shas@v3
|
- uses: nrwl/nx-set-shas@v3
|
||||||
id: last_successful_commit
|
id: last_successful_commit
|
||||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
if: github.event_name == 'pull_request' && github.event.action != 'closed' && matrix.fetch-depth == 0
|
||||||
with:
|
with:
|
||||||
main-branch-name: ${{ steps.branch-name.outputs.base_ref_branch }}
|
main-branch-name: ${{ steps.branch-name.outputs.base_ref_branch }}
|
||||||
workflow-id: 'test.yml'
|
workflow-id: 'test.yml'
|
||||||
- name: Run changed-files with a custom base sha
|
- name: Run changed-files with a custom base sha
|
||||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
if: github.event_name == 'pull_request' && github.event.action != 'closed' && matrix.fetch-depth == 0
|
||||||
id: changed-files-custom-base-sha
|
id: changed-files-custom-base-sha
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
base_sha: ${{ steps.last_successful_commit.outputs.base }}
|
base_sha: ${{ steps.last_successful_commit.outputs.base }}
|
||||||
- name: Show output
|
- name: Show output
|
||||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
if: github.event_name == 'pull_request' && github.event.action != 'closed' && matrix.fetch-depth == 0
|
||||||
run: |
|
run: |
|
||||||
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
|
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
|
||||||
shell:
|
shell:
|
||||||
|
@ -63,6 +63,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest # windows-latest | macos-latest
|
runs-on: ubuntu-latest # windows-latest | macos-latest
|
||||||
|
10
action.yml
10
action.yml
@ -81,13 +81,9 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
fetch_depth:
|
fetch_depth:
|
||||||
description: "Initial depth of the branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
|
description: "Depth of additional branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
|
||||||
required: false
|
required: false
|
||||||
default: "50"
|
default: "50"
|
||||||
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: "9000"
|
|
||||||
since_last_remote_commit:
|
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 remote commit of the current branch for push events."
|
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 remote commit of the current branch for push events."
|
||||||
required: true
|
required: true
|
||||||
@ -173,6 +169,7 @@ runs:
|
|||||||
GITHUB_BASE_REF: ${{ github.base_ref }}
|
GITHUB_BASE_REF: ${{ github.base_ref }}
|
||||||
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
||||||
GITHUB_WORKSPACE: ${{ github.workspace }}
|
GITHUB_WORKSPACE: ${{ github.workspace }}
|
||||||
|
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
|
||||||
GITHUB_EVENT_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }}
|
GITHUB_EVENT_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }}
|
||||||
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||||
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||||
@ -188,7 +185,6 @@ runs:
|
|||||||
INPUT_UNTIL: ${{ inputs.until }}
|
INPUT_UNTIL: ${{ inputs.until }}
|
||||||
INPUT_PATH: ${{ inputs.path }}
|
INPUT_PATH: ${{ inputs.path }}
|
||||||
INPUT_FETCH_DEPTH: ${{ inputs.fetch_depth }}
|
INPUT_FETCH_DEPTH: ${{ inputs.fetch_depth }}
|
||||||
INPUT_MAX_FETCH_DEPTH: ${{ inputs.max_fetch_depth }}
|
|
||||||
INPUT_SINCE_LAST_REMOTE_COMMIT: ${{ inputs.since_last_remote_commit }}
|
INPUT_SINCE_LAST_REMOTE_COMMIT: ${{ inputs.since_last_remote_commit }}
|
||||||
- name: Glob match
|
- name: Glob match
|
||||||
uses: tj-actions/glob@v16
|
uses: tj-actions/glob@v16
|
||||||
@ -204,6 +200,7 @@ runs:
|
|||||||
working-directory: ${{ inputs.path }}
|
working-directory: ${{ inputs.path }}
|
||||||
base-sha: ${{ steps.changed-files-diff-sha.outputs.previous_sha }}
|
base-sha: ${{ steps.changed-files-diff-sha.outputs.previous_sha }}
|
||||||
sha: ${{ steps.changed-files-diff-sha.outputs.current_sha }}
|
sha: ${{ steps.changed-files-diff-sha.outputs.current_sha }}
|
||||||
|
diff: ${{ steps.changed-files-diff-sha.outputs.diff }}
|
||||||
include-deleted-files: true
|
include-deleted-files: true
|
||||||
separator: "|"
|
separator: "|"
|
||||||
- run: |
|
- run: |
|
||||||
@ -223,6 +220,7 @@ runs:
|
|||||||
INPUT_CURRENT_SHA: ${{ steps.changed-files-diff-sha.outputs.current_sha }}
|
INPUT_CURRENT_SHA: ${{ steps.changed-files-diff-sha.outputs.current_sha }}
|
||||||
INPUT_TARGET_BRANCH: ${{ steps.changed-files-diff-sha.outputs.target_branch }}
|
INPUT_TARGET_BRANCH: ${{ steps.changed-files-diff-sha.outputs.target_branch }}
|
||||||
INPUT_CURRENT_BRANCH: ${{ steps.changed-files-diff-sha.outputs.current_branch }}
|
INPUT_CURRENT_BRANCH: ${{ steps.changed-files-diff-sha.outputs.current_branch }}
|
||||||
|
INPUT_DIFF: ${{ steps.changed-files-diff-sha.outputs.diff }}
|
||||||
INPUT_QUOTEPATH: ${{ inputs.quotepath }}
|
INPUT_QUOTEPATH: ${{ inputs.quotepath }}
|
||||||
INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES: ${{ inputs.include_all_old_new_renamed_files }}
|
INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES: ${{ inputs.include_all_old_new_renamed_files }}
|
||||||
INPUT_OLD_NEW_SEPARATOR: ${{ inputs.old_new_separator }}
|
INPUT_OLD_NEW_SEPARATOR: ${{ inputs.old_new_separator }}
|
||||||
|
91
diff-sha.sh
91
diff-sha.sh
@ -13,7 +13,7 @@ if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
|
|||||||
EXTRA_ARGS="--prune --no-recurse-submodules"
|
EXTRA_ARGS="--prune --no-recurse-submodules"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$GITHUB_EVENT_HEAD_REPO_FORK" == "true" ]]; then
|
if [[ -z $GITHUB_BASE_REF || "$GITHUB_EVENT_HEAD_REPO_FORK" == "true" ]]; then
|
||||||
DIFF=".."
|
DIFF=".."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -158,36 +158,6 @@ else
|
|||||||
|
|
||||||
echo "Fetching remote refs..."
|
echo "Fetching remote refs..."
|
||||||
|
|
||||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "false" ]]; then
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
git fetch -u --progress $EXTRA_ARGS --depth="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null 2>&1
|
|
||||||
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null 2>&1 || true
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
git fetch $EXTRA_ARGS -u --progress --depth=$(( GITHUB_EVENT_PULL_REQUEST_COMMITS + 1 )) origin +"$GITHUB_REF":refs/remotes/origin/"$CURRENT_BRANCH" 1>/dev/null 2>&1
|
|
||||||
|
|
||||||
COMMON_ANCESTOR=$(git merge-base --fork-point "$TARGET_BRANCH" HEAD) && exit_status=$? || exit_status=$?
|
|
||||||
|
|
||||||
if [[ -z "$COMMON_ANCESTOR" ]]; then
|
|
||||||
echo "::debug::Unable to locate a common ancestor for the current branch: $CURRENT_BRANCH"
|
|
||||||
else
|
|
||||||
echo "::debug::Common ancestor: $COMMON_ANCESTOR"
|
|
||||||
|
|
||||||
DATE=$(git show --quiet --date=iso8601 --format=%cd "$COMMON_ANCESTOR")
|
|
||||||
|
|
||||||
if [[ -z "$DATE" ]]; then
|
|
||||||
echo "::error::Unable to locate a date for the common ancestor: $COMMON_ANCESTOR"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
git fetch $EXTRA_ARGS --shallow-since="${DATE}" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null 2>&1
|
|
||||||
echo "::debug::Date: $DATE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
git fetch $EXTRA_ARGS -u --progress --depth="$INPUT_FETCH_DEPTH" origin +"$GITHUB_REF":refs/remotes/origin/"$CURRENT_BRANCH" 1>/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "::debug::Getting HEAD SHA..."
|
echo "::debug::Getting HEAD SHA..."
|
||||||
if [[ -n "$INPUT_UNTIL" ]]; then
|
if [[ -n "$INPUT_UNTIL" ]]; then
|
||||||
echo "::debug::Getting HEAD SHA for '$INPUT_UNTIL'..."
|
echo "::debug::Getting HEAD SHA for '$INPUT_UNTIL'..."
|
||||||
@ -198,6 +168,9 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1
|
||||||
|
|
||||||
if [[ -z $INPUT_SHA ]]; then
|
if [[ -z $INPUT_SHA ]]; then
|
||||||
CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$?
|
CURRENT_SHA=$(git rev-list -n 1 HEAD) && exit_status=$? || exit_status=$?
|
||||||
else
|
else
|
||||||
@ -222,21 +195,26 @@ else
|
|||||||
|
|
||||||
if [[ -z $INPUT_BASE_SHA ]]; then
|
if [[ -z $INPUT_BASE_SHA ]]; then
|
||||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
|
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
|
||||||
|
echo "::debug::Fetching remote current branch..."
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null 2>&1
|
||||||
|
|
||||||
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
|
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
|
||||||
|
|
||||||
if ! git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; then
|
if ! git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; then
|
||||||
PREVIOUS_SHA=$(git rev-parse origin/"$CURRENT_BRANCH")
|
PREVIOUS_SHA=$(git rev-parse origin/"$CURRENT_BRANCH")
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=${COMMON_ANCESTOR:-}
|
echo "::debug::Fetching remote target branch..."
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$TARGET_BRANCH" 1>/dev/null 2>&1
|
||||||
|
|
||||||
if [[ -z "$PREVIOUS_SHA" ]]; then
|
echo "::debug::Fetching remote current branch..."
|
||||||
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?
|
# shellcheck disable=SC2086
|
||||||
fi
|
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null 2>&1
|
||||||
|
|
||||||
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
PREVIOUS_SHA=$(git merge-base origin/"$TARGET_BRANCH" "$CURRENT_SHA") && exit_status=$? || exit_status=$?
|
||||||
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
||||||
@ -248,36 +226,13 @@ else
|
|||||||
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "false" ]]; then
|
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||||
if [[ -f .git/shallow ]]; then
|
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
||||||
depth=$INPUT_FETCH_DEPTH
|
DIFF=".."
|
||||||
max_depth=$INPUT_MAX_FETCH_DEPTH
|
|
||||||
|
|
||||||
for ((i=20; i<max_depth; i+=depth)); do
|
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||||
if git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
echo "::error::Unable find a diff between $PREVIOUS_SHA and $CURRENT_SHA"
|
||||||
break
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$INPUT_BASE_SHA" ]]; then
|
|
||||||
NEW_PREVIOUS_SHA=$(git merge-base --fork-point "$TARGET_BRANCH" "$CURRENT_SHA") && exit_status=$? || exit_status=$?
|
|
||||||
|
|
||||||
if [[ -n "$NEW_PREVIOUS_SHA" ]]; then
|
|
||||||
PREVIOUS_SHA=$NEW_PREVIOUS_SHA
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Fetching $i commits..."
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
git fetch $EXTRA_ARGS -u --progress --deepen="$i" origin $TARGET_BRANCH $CURRENT_SHA 1>/dev/null 2>&1
|
|
||||||
done
|
|
||||||
|
|
||||||
if ((i > max_depth)); then
|
|
||||||
echo "::error::Unable to locate a common ancestor between $TARGET_BRANCH and $CURRENT_BRANCH with: $PREVIOUS_SHA$DIFF$CURRENT_SHA"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "::debug::Not a shallow clone, skipping merge-base check."
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -305,12 +260,14 @@ if [[ -z "$GITHUB_OUTPUT" ]]; then
|
|||||||
echo "::set-output name=current_branch::$CURRENT_BRANCH"
|
echo "::set-output name=current_branch::$CURRENT_BRANCH"
|
||||||
echo "::set-output name=previous_sha::$PREVIOUS_SHA"
|
echo "::set-output name=previous_sha::$PREVIOUS_SHA"
|
||||||
echo "::set-output name=current_sha::$CURRENT_SHA"
|
echo "::set-output name=current_sha::$CURRENT_SHA"
|
||||||
|
echo "::set-output name=diff::$DIFF"
|
||||||
else
|
else
|
||||||
cat <<EOF >> "$GITHUB_OUTPUT"
|
cat <<EOF >> "$GITHUB_OUTPUT"
|
||||||
target_branch=$TARGET_BRANCH
|
target_branch=$TARGET_BRANCH
|
||||||
current_branch=$CURRENT_BRANCH
|
current_branch=$CURRENT_BRANCH
|
||||||
previous_sha=$PREVIOUS_SHA
|
previous_sha=$PREVIOUS_SHA
|
||||||
current_sha=$CURRENT_SHA
|
current_sha=$CURRENT_SHA
|
||||||
|
diff=$DIFF
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,11 +8,7 @@ INPUT_SEPARATOR="${INPUT_SEPARATOR//$'\n'/'%0A'}"
|
|||||||
INPUT_SEPARATOR="${INPUT_SEPARATOR//$'\r'/'%0D'}"
|
INPUT_SEPARATOR="${INPUT_SEPARATOR//$'\r'/'%0D'}"
|
||||||
|
|
||||||
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
|
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
|
||||||
DIFF="..."
|
DIFF=$INPUT_DIFF
|
||||||
|
|
||||||
if [[ -z $GITHUB_BASE_REF || "$GITHUB_EVENT_HEAD_REPO_FORK" == "true" ]]; then
|
|
||||||
DIFF=".."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $INPUT_QUOTEPATH == "false" ]]; then
|
if [[ $INPUT_QUOTEPATH == "false" ]]; then
|
||||||
git config --global core.quotepath off
|
git config --global core.quotepath off
|
||||||
@ -78,14 +74,14 @@ function get_diff() {
|
|||||||
done < <(git submodule | awk '{print $2}')
|
done < <(git submodule | awk '{print $2}')
|
||||||
|
|
||||||
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
||||||
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$DIFF$sha" | xargs -I {} dirname {} | get_dirname_max_depth | uniq && exit_status=$? || exit_status=$?
|
git diff --diff-filter="$filter" --name-only --ignore-submodules=all --no-merges "$base$DIFF$sha" | xargs -I {} dirname {} | get_dirname_max_depth | uniq && exit_status=$? || exit_status=$?
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::error::Failed to get changed directories between: $base$DIFF$sha"
|
echo "::error::Failed to get changed directories between: $base$DIFF$sha"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$DIFF$sha" && exit_status=$? || exit_status=$?
|
git diff --diff-filter="$filter" --name-only --ignore-submodules=all --no-merges "$base$DIFF$sha" && exit_status=$? || exit_status=$?
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::error::Failed to get changed files between: $base$DIFF$sha"
|
echo "::error::Failed to get changed files between: $base$DIFF$sha"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user