Compare commits

...

21 Commits

Author SHA1 Message Date
Tonye Jack
72d3bb8b33 Merge pull request #779 from tj-actions/chore/update-readme
chore: update readme
2022-11-07 08:23:09 -07:00
Tonye Jack
d908ddd2ef Merge pull request #780 from tj-actions/fix/similar-commit-hashes 2022-11-07 08:21:33 -07:00
Tonye Jack
8dc46ae460 fix: similar commit hashes 2022-11-07 08:04:54 -07:00
Tonye Jack
1218e11f1e chore: update readme 2022-11-07 07:11:40 -07:00
Tonye Jack
18ddeeb8bc Merge pull request #777 from tj-actions/upgrade-to-v34.3.0 2022-11-07 07:09:37 -07:00
jackton1
3b614c0cfa Upgraded from v34.2.2 -> v34.3.0 2022-11-07 07:56:36 +00:00
Tonye Jack
5f89dc7d6e Merge pull request #776 from tj-actions/chore/exclude-fetching-tag
chore: exclude fetching tags
2022-11-06 23:51:55 -07:00
Tonye Jack
2d251d6924 Update diff-sha.sh 2022-11-06 23:49:17 -07:00
Tonye Jack
c46761fdcd Update diff-sha.sh 2022-11-06 23:28:15 -07:00
Tonye Jack
321490c60a Update diff-sha.sh 2022-11-06 22:53:53 -07:00
Tonye Jack
dc88c3a0c5 chore: exclude fetching tags 2022-11-06 22:31:54 -07:00
Tonye Jack
2125c059c3 Merge pull request #775 from tj-actions/chore/update-test
chore: update test
2022-11-06 21:58:23 -07:00
Tonye Jack
f6e319ef2e Merge branch 'main' into chore/update-test 2022-11-06 21:50:44 -07:00
Tonye Jack
3d1f14f079 Merge pull request #774 from tj-actions/chore/update-readme 2022-11-06 21:19:53 -07:00
Tonye Jack
1abc7bec79 chore: update test 2022-11-06 21:18:59 -07:00
jackton1
18dfe0dd4e Updated README.md 2022-11-07 04:00:58 +00:00
Tonye Jack
c94657a1d8 Merge pull request #773 from tj-actions/feat/add-support-for-using-the-last-remote-commit
feat: add support for using the last remote commit
2022-11-06 21:00:26 -07:00
Tonye Jack
c755692dde Update test.yml 2022-11-06 20:50:36 -07:00
Tonye Jack
1e46f60599 feat: add support for using the last remote commit 2022-11-06 19:50:53 -07:00
Tonye Jack
f009ea4a47 Merge pull request #772 from tj-actions/upgrade-to-v34.2.2
Upgraded to v34.2.2
2022-11-06 11:21:25 -07:00
jackton1
7cdc68de58 Upgraded from v34.2.1 -> v34.2.2 2022-11-06 17:52:52 +00:00
5 changed files with 153 additions and 73 deletions

View File

@@ -361,6 +361,16 @@ jobs:
echo '${{ toJSON(steps.changed-files.outputs) }}'
shell:
bash
- name: Run changed-files with since_last_remote_commit
id: changed-files-since-last-remote-commit
uses: ./
with:
since_last_remote_commit: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
shell:
bash
- name: Run changed-files with include_all_old_new_renamed_files
id: changed-files-all-old-new-renamed-files
uses: ./
@@ -899,7 +909,7 @@ jobs:
bash
- name: Run changed-files with custom sha
id: changed-files-custom-sha
if: github.event.action != 'closed'
if: github.event_name == 'pull_request' && github.event.action != 'closed'
uses: ./
with:
sha: ${{ github.event.pull_request.head.sha }}

View File

@@ -1,12 +1,41 @@
# Changelog
## [v34.3.0](https://github.com/tj-actions/changed-files/tree/v34.3.0) (2022-11-07)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34...v34.3.0)
## [v34](https://github.com/tj-actions/changed-files/tree/v34) (2022-11-07)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.2.2...v34)
**Closed issues:**
- How can I let the workflow to detect the changes only in the certain micro service? [\#766](https://github.com/tj-actions/changed-files/issues/766)
**Merged pull requests:**
- chore: exclude fetching tags [\#776](https://github.com/tj-actions/changed-files/pull/776) ([jackton1](https://github.com/jackton1))
- chore: update test [\#775](https://github.com/tj-actions/changed-files/pull/775) ([jackton1](https://github.com/jackton1))
- Updated README.md [\#774](https://github.com/tj-actions/changed-files/pull/774) ([jackton1](https://github.com/jackton1))
- feat: add support for using the last remote commit [\#773](https://github.com/tj-actions/changed-files/pull/773) ([jackton1](https://github.com/jackton1))
- Upgraded to v34.2.2 [\#772](https://github.com/tj-actions/changed-files/pull/772) ([jackton1](https://github.com/jackton1))
## [v34.2.2](https://github.com/tj-actions/changed-files/tree/v34.2.2) (2022-11-06)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.2.1...v34.2.2)
**Merged pull requests:**
- Updated README.md [\#771](https://github.com/tj-actions/changed-files/pull/771) ([jackton1](https://github.com/jackton1))
- Updated README.md [\#770](https://github.com/tj-actions/changed-files/pull/770) ([jackton1](https://github.com/jackton1))
- Updated README.md [\#769](https://github.com/tj-actions/changed-files/pull/769) ([jackton1](https://github.com/jackton1))
- docs: add kenji-miyake as a contributor for code [\#768](https://github.com/tj-actions/changed-files/pull/768) ([allcontributors[bot]](https://github.com/apps/allcontributors))
- chore: change `sha` to non-required [\#767](https://github.com/tj-actions/changed-files/pull/767) ([kenji-miyake](https://github.com/kenji-miyake))
- Upgraded to v34.2.1 [\#765](https://github.com/tj-actions/changed-files/pull/765) ([jackton1](https://github.com/jackton1))
## [v34.2.1](https://github.com/tj-actions/changed-files/tree/v34.2.1) (2022-11-05)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34...v34.2.1)
## [v34](https://github.com/tj-actions/changed-files/tree/v34) (2022-11-05)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.2.0...v34)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.2.0...v34.2.1)
**Merged pull requests:**
@@ -321,7 +350,7 @@
## [v30](https://github.com/tj-actions/changed-files/tree/v30) (2022-09-24)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29...v30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.9...v30)
**Fixed bugs:**
@@ -337,13 +366,13 @@
- chore\(deps\): update codacy/codacy-analysis-cli-action action to v4.2.0 [\#634](https://github.com/tj-actions/changed-files/pull/634) ([renovate[bot]](https://github.com/apps/renovate))
- Upgraded to v29.0.9 [\#633](https://github.com/tj-actions/changed-files/pull/633) ([jackton1](https://github.com/jackton1))
## [v29](https://github.com/tj-actions/changed-files/tree/v29) (2022-09-20)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.9...v29)
## [v29.0.9](https://github.com/tj-actions/changed-files/tree/v29.0.9) (2022-09-20)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.8...v29.0.9)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29...v29.0.9)
## [v29](https://github.com/tj-actions/changed-files/tree/v29) (2022-09-20)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.8...v29)
**Implemented enhancements:**
@@ -1202,7 +1231,7 @@
## [v13](https://github.com/tj-actions/changed-files/tree/v13) (2022-02-17)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.0.1...v13)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.2...v13)
**Implemented enhancements:**
@@ -1221,13 +1250,13 @@
- \[BUG\] wrong result of any\_change output [\#314](https://github.com/tj-actions/changed-files/issues/314)
- \[BUG\] Investigate possible bug using since\_last\_remote\_commit when force pushing changes. [\#303](https://github.com/tj-actions/changed-files/issues/303)
## [v2.0.1](https://github.com/tj-actions/changed-files/tree/v2.0.1) (2021-12-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.2...v2.0.1)
## [v12.2](https://github.com/tj-actions/changed-files/tree/v12.2) (2021-12-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.1...v12.2)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.0.1...v12.2)
## [v2.0.1](https://github.com/tj-actions/changed-files/tree/v2.0.1) (2021-12-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.1...v2.0.1)
**Merged pull requests:**
@@ -1268,7 +1297,7 @@
## [v12](https://github.com/tj-actions/changed-files/tree/v12) (2021-12-14)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11...v12)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v12)
**Implemented enhancements:**
@@ -1286,13 +1315,13 @@
- \[PR 1\]: Renamed all\_modified\_files to all\_changed\_files [\#283](https://github.com/tj-actions/changed-files/pull/283) ([jackton1](https://github.com/jackton1))
- Upgraded to v11.9 [\#280](https://github.com/tj-actions/changed-files/pull/280) ([jackton1](https://github.com/jackton1))
## [v11](https://github.com/tj-actions/changed-files/tree/v11) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v11)
## [v11.9](https://github.com/tj-actions/changed-files/tree/v11.9) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.3.1...v11.9)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11...v11.9)
## [v11](https://github.com/tj-actions/changed-files/tree/v11) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.3.1...v11)
**Implemented enhancements:**
@@ -1381,7 +1410,7 @@
## [v1.2.1](https://github.com/tj-actions/changed-files/tree/v1.2.1) (2021-11-08)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.5...v1.2.1)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.2.0...v1.2.1)
**Implemented enhancements:**
@@ -1395,13 +1424,13 @@
- Update actions/checkout action to v2.4.0 [\#243](https://github.com/tj-actions/changed-files/pull/243) ([renovate[bot]](https://github.com/apps/renovate))
- Upgraded to v11.5 [\#241](https://github.com/tj-actions/changed-files/pull/241) ([jackton1](https://github.com/jackton1))
## [v11.5](https://github.com/tj-actions/changed-files/tree/v11.5) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.2.0...v11.5)
## [v1.2.0](https://github.com/tj-actions/changed-files/tree/v1.2.0) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.4...v1.2.0)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.5...v1.2.0)
## [v11.5](https://github.com/tj-actions/changed-files/tree/v11.5) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.4...v11.5)
**Merged pull requests:**

View File

@@ -153,28 +153,29 @@ Support this project with a :star:
<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|-----------------------------------|--------|----------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| base\_sha | string | false | | Specify a different base commit<br>SHA used for comparing changes<br> |
| diff\_relative | string | false | | Exclude changes outside the current<br>directory and show pathnames relative<br>to it. **NOTE:** This requires<br>you to specify the top<br>level directory via the `path`<br>input. |
| dir\_names | string | false | `"false"` | Output unique changed directories instead<br>of filenames. **NOTE:** This returns<br>`.` for changed files located<br>in the root of the<br>project. |
| fetch\_depth | string | false | `"40"` | Limit depth of the branch<br>history fetched. **NOTE**: This can<br>be adjusted to resolve errors<br>with insufficient history. |
| files | string | false | | File and directory patterns to<br>detect changes using only these<br>list of file(s) (Defaults to<br>the entire repo) **NOTE:** Multiline<br>file/directory patterns should not include<br>qoutes. |
| files\_from\_source\_file | string | false | | Source file(s) used to populate<br>the `files` input. |
| files\_ignore | string | false | | Ignore changes to these file(s)<br>**NOTE:** Multiline file/directory patterns should<br>not include qoutes. |
| files\_ignore\_from\_source\_file | string | false | | Source file(s) used to populate<br>the `files_ignore` input |
| files\_ignore\_separator | string | false | `"\n"` | Separator used to split the<br>`files-ignore` input |
| files\_separator | string | false | `"\n"` | Separator used to split the<br>`files` input |
| include\_all\_old\_new\_renamed\_files | string | false | `"false"` | Include `all_old_new_renamed_files` output. Note this<br>can generate a large output<br>See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
| json | string | false | `"false"` | Output list of changed files<br>in a JSON formatted string<br>which can be used for<br>matrix jobs. |
| old\_new\_files\_separator | string | false | `" "` | Split character for multiple old<br>and new filename pairs. |
| old\_new\_separator | string | false | `","` | Split character for old and<br>new filename pairs. |
| path | string | false | `"."` | Specify a relative path under<br>`$GITHUB_WORKSPACE` to locate the repository.<br> |
| quotepath | string | false | `"true"` | Use non ascii characters to<br>match files and output the<br>filenames completely verbatim by setting<br>this to `false` |
| separator | string | false | `" "` | Split character for output strings<br> |
| sha | string | false | `"${{ github.sha }}"` | Specify a different commit SHA<br>used for comparing changes |
| since | string | false | | Get changed files for commits<br>whose timestamp is older than<br>the given time. |
| until | string | false | | Get changed files for commits<br>whose timestamp is earlier than<br>the given time. |
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|-----------------------------------|--------|----------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| base\_sha | string | false | | Specify a different base commit<br>SHA used for comparing changes<br> |
| diff\_relative | string | false | | Exclude changes outside the current<br>directory and show pathnames relative<br>to it. **NOTE:** This requires<br>you to specify the top<br>level directory via the `path`<br>input. |
| dir\_names | string | false | `"false"` | Output unique changed directories instead<br>of filenames. **NOTE:** This returns<br>`.` for changed files located<br>in the root of the<br>project. |
| fetch\_depth | string | false | `"40"` | Limit depth of the branch<br>history fetched. **NOTE**: This can<br>be adjusted to resolve errors<br>with insufficient history. |
| files | string | false | | File and directory patterns to<br>detect changes using only these<br>list of file(s) (Defaults to<br>the entire repo) **NOTE:** Multiline<br>file/directory patterns should not include<br>qoutes. |
| files\_from\_source\_file | string | false | | Source file(s) used to populate<br>the `files` input. |
| files\_ignore | string | false | | Ignore changes to these file(s)<br>**NOTE:** Multiline file/directory patterns should<br>not include qoutes. |
| files\_ignore\_from\_source\_file | string | false | | Source file(s) used to populate<br>the `files_ignore` input |
| files\_ignore\_separator | string | false | `"\n"` | Separator used to split the<br>`files-ignore` input |
| files\_separator | string | false | `"\n"` | Separator used to split the<br>`files` input |
| include\_all\_old\_new\_renamed\_files | string | false | `"false"` | Include `all_old_new_renamed_files` output. Note this<br>can generate a large output<br>See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
| json | string | false | `"false"` | Output list of changed files<br>in a JSON formatted string<br>which can be used for<br>matrix jobs. |
| old\_new\_files\_separator | string | false | `" "` | Split character for multiple old<br>and new filename pairs. |
| old\_new\_separator | string | false | `","` | Split character for old and<br>new filename pairs. |
| path | string | false | `"."` | Specify a relative path under<br>`$GITHUB_WORKSPACE` to locate the repository.<br> |
| quotepath | string | false | `"true"` | Use non ascii characters to<br>match files and output the<br>filenames completely verbatim by setting<br>this to `false` |
| separator | string | false | `" "` | Split character for output strings<br> |
| sha | string | false | `"${{ github.sha }}"` | Specify a different commit SHA<br>used for comparing changes |
| since | string | false | | Get changed files for commits<br>whose timestamp is older than<br>the given time. |
| since\_last\_remote\_commit | string | true | `"false"` | Use the last commit on<br>the remote branch as the<br>`base_sha`. Defaults to the last<br>non merge commit on the<br>target branch for pull request<br>events and the previous commit<br>of the current branch for<br>push events. |
| until | string | false | | Get changed files for commits<br>whose timestamp is earlier than<br>the given time. |
<!-- AUTO-DOC-INPUT:END -->
@@ -594,6 +595,7 @@ This package was created with [Cookiecutter](https://github.com/cookiecutter/coo
* [tj-actions/glob](https://github.com/tj-actions/glob)
* [tj-actions/demo](https://github.com/tj-actions/demo)
* [tj-actions/demo2](https://github.com/tj-actions/demo2)
* [tj-actions/demo3](https://github.com/tj-actions/demo3)
* [tj-actions/release-tagger](https://github.com/tj-actions/release-tagger)
* [tj-actions/auto-doc](https://github.com/tj-actions/auto-doc)
* [tj-actions/verify-changed-files](https://github.com/tj-actions/verify-changed-files)

View File

@@ -81,6 +81,10 @@ inputs:
description: "Limit depth of the branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
required: false
default: "40"
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 commit of the current branch for push events."
required: true
default: "false"
outputs:
added_files:
@@ -173,6 +177,7 @@ runs:
INPUT_UNTIL: ${{ inputs.until }}
INPUT_PATH: ${{ inputs.path }}
INPUT_FETCH_DEPTH: ${{ inputs.fetch_depth }}
INPUT_SINCE_LAST_REMOTE_COMMIT: ${{ inputs.since_last_remote_commit }}
- name: Glob match
uses: tj-actions/glob@v15
id: glob

View File

@@ -4,6 +4,11 @@ set -euo pipefail
INITIAL_COMMIT="false"
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
EXTRA_ARGS="--no-tags"
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
EXTRA_ARGS=""
fi
echo "::group::changed-files-diff-sha"
@@ -56,7 +61,8 @@ if [[ -z $GITHUB_BASE_REF ]]; then
if [[ -z $INPUT_SHA ]]; then
CURRENT_SHA=$(git rev-list -n 1 HEAD 2>&1) && exit_status=$? || exit_status=$?
else
git fetch --no-tags -u --progress --deepen="$INPUT_FETCH_DEPTH"
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH"
CURRENT_SHA=$INPUT_SHA; exit_status=$?
fi
fi
@@ -82,12 +88,20 @@ if [[ -z $GITHUB_BASE_REF ]]; then
exit 1
fi
else
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
if [[ -z "$PREVIOUS_SHA" ]]; then
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
PREVIOUS_SHA=""
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
fi
else
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
if [[ -z "$PREVIOUS_SHA" ]]; then
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
fi
fi
fi
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
@@ -110,7 +124,8 @@ if [[ -z $GITHUB_BASE_REF ]]; then
fi
fi
else
git fetch --no-tags -u --progress --deepen="$INPUT_FETCH_DEPTH"
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH"
PREVIOUS_SHA=$INPUT_BASE_SHA
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
CURRENT_BRANCH=$TARGET_BRANCH
@@ -133,21 +148,26 @@ else
CURRENT_BRANCH=$GITHUB_HEAD_REF
echo "Fetching remote refs..."
git fetch --depth="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH"
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 2>/dev/null || true
depth=$INPUT_FETCH_DEPTH
while [ -z "$( git merge-base "$TARGET_BRANCH" HEAD )" ]; do
git fetch --deepen="$depth" origin "$TARGET_BRANCH" HEAD;
depth=$((depth * 10))
max_depth=5000
if [[ $depth -gt $max_depth ]]; then
echo "::error::Unable to find merge-base between $TARGET_BRANCH and HEAD."
fi
done
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "false" ]]; then
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS --depth="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH"
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 2>/dev/null || true
depth=$INPUT_FETCH_DEPTH
while [ -z "$( git merge-base "$TARGET_BRANCH" HEAD )" ]; do
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS --deepen="$depth" origin "$TARGET_BRANCH" HEAD;
depth=$((depth * 10))
max_depth=5000
if [[ $depth -gt $max_depth ]]; then
echo "::error::Unable to find merge-base between $TARGET_BRANCH and HEAD."
exit 1
fi
done
fi
echo "::debug::Getting HEAD SHA..."
if [[ -n "$INPUT_UNTIL" ]]; then
@@ -178,10 +198,24 @@ else
fi
if [[ -z $INPUT_BASE_SHA ]]; then
PREVIOUS_SHA=$(git rev-list --no-merges -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
if [[ -z "$PREVIOUS_SHA" ]]; then
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
PREVIOUS_SHA=""
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
fi
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
fi
else
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
fi
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?
fi
echo "::debug::Previous SHA: $PREVIOUS_SHA"
else
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?