Merge pull request #640 from tj-actions/feat/add-support-for-closed-pull-request-with-merge-set-to-true
feat: add support for closed pull requests with merge true
This commit is contained in:
commit
8e3ce84d94
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@ -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: |
|
||||
|
@ -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_<VARIABLE_NAME> 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
|
||||
|
13
diff-sha.sh
13
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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user