diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8bba7f4e22..96d0d0e1321 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -176,7 +176,14 @@ 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/action.yml b/action.yml index c16392663da..bd21472b482 100644 --- a/action.yml +++ b/action.yml @@ -66,10 +66,6 @@ inputs: description: "Specify a relative path under $GITHUB_WORKSPACE to locate the repository" required: false default: "." - use_fork_point: - description: "Finds best common ancestor between two commits to use in a three-way merge as the base_sha" - default: "false" - required: false quotepath: description: "Output filenames completely verbatim by setting this to false" default: "true" @@ -201,12 +197,12 @@ runs: GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_ACTION_PATH: ${{ github.action_path }} GITHUB_WORKSPACE: ${{ github.workspace }} + GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }} # INPUT_ is not available in Composite run steps # https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611 INPUT_SHA: ${{ steps.sha.outputs.sha }} INPUT_BASE_SHA: ${{ steps.base-sha.outputs.base_sha }} INPUT_PATH: ${{ inputs.path }} - INPUT_USE_FORK_POINT: ${{ inputs.use_fork_point }} - name: Glob match uses: tj-actions/glob@v13 id: glob diff --git a/diff-sha.sh b/diff-sha.sh index 1e17d360e1a..9116f3ba3fd 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -96,18 +96,9 @@ else echo "::debug::GITHUB_BASE_REF: $TARGET_BRANCH..." if [[ -z $INPUT_BASE_SHA ]]; then - if [[ "$INPUT_USE_FORK_POINT" == "true" ]]; then - echo "::debug::Getting fork point..." - git fetch --no-tags -u --progress origin "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? - PREVIOUS_SHA=$(git merge-base --fork-point "${TARGET_BRANCH}" "$(git name-rev --name-only "$CURRENT_SHA")") && exit_status=$? || exit_status=$? - echo "::debug::Previous SHA: $PREVIOUS_SHA" - else - git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? - PREVIOUS_SHA=$(git rev-list -n 1 "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? - echo "::debug::Previous SHA: $PREVIOUS_SHA" - fi + 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"