Compare commits

...

12 Commits
v25 ... v26

Author SHA1 Message Date
Tonye Jack
7394701157 Updated README.md (#575)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-08-14 20:45:25 -06:00
Tonye Jack
234423e82b chore: remove extra space. (#576) 2022-08-14 20:38:10 -06:00
Charles Santos
f834a938f2 improvement: Simplify checks (#570)
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2022-08-14 20:36:27 -06:00
allcontributors[bot]
d2bf1ba9cd docs: add thyarles as a contributor for code (#574)
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-08-14 20:34:46 -06:00
Tonye Jack
8ec2566464 chore: restrict rename test to non forks (#573) 2022-08-14 20:26:46 -06:00
Tonye Jack
7dd9711c64 feat: validate the minimum required git version (#572)
* feat: validate the minimum required git version

Closes: #564

* Update diff-sha.sh

* Update diff-sha.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update diff-sha.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-08-13 15:50:50 -06:00
Tonye Jack
0c7f7d1ce7 chore: remove unused code (#571) 2022-08-13 14:54:51 -06:00
Tonye Jack
abfa34ddb6 Update README.md 2022-08-11 22:37:26 -06:00
Tonye Jack
6d5cf3f952 Update README.md 2022-08-11 22:32:20 -06:00
Tonye Jack
5f910fc7e7 Update README.md 2022-08-11 22:20:38 -06:00
Tonye Jack
dd75630a57 Update README.md 2022-08-11 21:59:16 -06:00
Tonye Jack
9014219205 Upgraded to v25 (#567)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-08-08 13:56:57 -06:00
5 changed files with 85 additions and 38 deletions

View File

@@ -123,6 +123,15 @@
"contributions": [ "contributions": [
"doc" "doc"
] ]
},
{
"login": "thyarles",
"name": "Charles Santos",
"avatar_url": "https://avatars.githubusercontent.com/u/1340046?v=4",
"profile": "https://www.credly.com/users/thyarles/badges",
"contributions": [
"code"
]
} }
], ],
"contributorsPerLine": 7, "contributorsPerLine": 7,

View File

@@ -367,18 +367,20 @@ jobs:
bash bash
- name: Run changed-files for old new filenames test rename 1 - name: Run changed-files for old new filenames test rename 1
id: changed-files-all-old-new-renamed-files-1 id: changed-files-all-old-new-renamed-files-1
if: contains('dependabot[bot] dependabot renovate[bot] renovate', github.actor) || github.event.pull_request.head.repo.owner.login == github.repository_owner
uses: ./ uses: ./
with: with:
base_sha: d1c0ee4 base_sha: d1c0ee4
sha: 4d04215 sha: 4d04215
include_all_old_new_renamed_files: true include_all_old_new_renamed_files: true
- name: Show output - name: Show output
if: contains('dependabot[bot] dependabot renovate[bot] renovate', github.actor) || github.event.pull_request.head.repo.owner.login == github.repository_owner
run: | run: |
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}' echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}'
shell: shell:
bash bash
- name: Check all_old_new_renamed_files output - name: Check all_old_new_renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt')" if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt') && (contains('dependabot[bot] dependabot renovate[bot] renovate', github.actor) || github.event.pull_request.head.repo.owner.login == github.repository_owner)"
run: | run: |
echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files }})" echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files }})"
exit 1 exit 1
@@ -386,18 +388,20 @@ jobs:
bash bash
- name: Run changed-files for old new filenames test rename 2 - name: Run changed-files for old new filenames test rename 2
id: changed-files-all-old-new-renamed-files-2 id: changed-files-all-old-new-renamed-files-2
if: contains('dependabot[bot] dependabot renovate[bot] renovate', github.actor) || github.event.pull_request.head.repo.owner.login == github.repository_owner
uses: ./ uses: ./
with: with:
base_sha: 4d04215 base_sha: 4d04215
sha: fe238e6 sha: fe238e6
include_all_old_new_renamed_files: true include_all_old_new_renamed_files: true
- name: Show output - name: Show output
if: contains('dependabot[bot] dependabot renovate[bot] renovate', github.actor) || github.event.pull_request.head.repo.owner.login == github.repository_owner
run: | run: |
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}' echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}'
shell: shell:
bash bash
- name: Check all_old_new_renamed_files output - name: Check all_old_new_renamed_files output
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt')" if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt') && (contains('dependabot[bot] dependabot renovate[bot] renovate', github.actor) || github.event.pull_request.head.repo.owner.login == github.repository_owner)"
run: | run: |
echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files }})" echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files }})"
exit 1 exit 1

View File

@@ -1,5 +1,26 @@
# Changelog # Changelog
## [Unreleased](https://github.com/tj-actions/changed-files/tree/HEAD)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v25...HEAD)
**Fixed bugs:**
- \[BUG\] Will output all changed files if not file matches the `**/*.sql` pattern [\#565](https://github.com/tj-actions/changed-files/issues/565)
## [v25](https://github.com/tj-actions/changed-files/tree/v25) (2022-08-08)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v24.1...v25)
**Fixed bugs:**
- \[BUG\] missing opening '\(' then stop with windows-latest [\#562](https://github.com/tj-actions/changed-files/issues/562)
**Merged pull requests:**
- chore\(deps\): upgrade tj-actions/glob v9.2 to v10 [\#566](https://github.com/tj-actions/changed-files/pull/566) ([jackton1](https://github.com/jackton1))
- Upgraded to v24.1 [\#561](https://github.com/tj-actions/changed-files/pull/561) ([jackton1](https://github.com/jackton1))
## [v24.1](https://github.com/tj-actions/changed-files/tree/v24.1) (2022-08-03) ## [v24.1](https://github.com/tj-actions/changed-files/tree/v24.1) (2022-08-03)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v24...v24.1) [Full Changelog](https://github.com/tj-actions/changed-files/compare/v24...v24.1)

View File

@@ -7,7 +7,7 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) [![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END --> <!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -70,7 +70,7 @@ jobs:
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
- name: List all changed files - name: List all changed files
run: | run: |
@@ -163,11 +163,11 @@ Support this project with a :star:
- name: Get changed files using defaults - name: Get changed files using defaults
id: changed-files id: changed-files
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
- name: Get changed files using a comma separator - name: Get changed files using a comma separator
id: changed-files-comma id: changed-files-comma
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
separator: "," separator: ","
@@ -189,7 +189,7 @@ Support this project with a :star:
- name: Get specific changed files - name: Get specific changed files
id: changed-files-specific id: changed-files-specific
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
files: | files: |
my-file.txt my-file.txt
@@ -230,14 +230,14 @@ Support this project with a :star:
- name: Use a source file or list of file(s) to populate to files input. - name: Use a source file or list of file(s) to populate to files input.
id: changed-files-specific-source-file id: changed-files-specific-source-file
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
files_from_source_file: | files_from_source_file: |
test/changed-files-list.txt test/changed-files-list.txt
- name: Use a source file or list of file(s) to populate to files input and optionally specify more files. - name: Use a source file or list of file(s) to populate to files input and optionally specify more files.
id: changed-files-specific-source-file-and-specify-files id: changed-files-specific-source-file-and-specify-files
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
files_from_source_file: | files_from_source_file: |
test/changed-files-list.txt test/changed-files-list.txt
@@ -246,13 +246,13 @@ Support this project with a :star:
- name: Use a different commit SHA - name: Use a different commit SHA
id: changed-files-custom-sha id: changed-files-custom-sha
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
sha: ${{ github.event.pull_request.head.sha }} sha: ${{ github.event.pull_request.head.sha }}
- name: Use a different base SHA - name: Use a different base SHA
id: changed-files-custom-base-sha id: changed-files-custom-base-sha
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
base_sha: "2096ed0" base_sha: "2096ed0"
@@ -264,7 +264,7 @@ Support this project with a :star:
- name: Run changed-files with defaults on the dir1 - name: Run changed-files with defaults on the dir1
id: changed-files-for-dir1 id: changed-files-for-dir1
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
path: dir1 path: dir1
@@ -276,19 +276,19 @@ Support this project with a :star:
- name: Run changed-files using the last commit on the remote branch - name: Run changed-files using the last commit on the remote branch
id: changed-files-since-last-remote-commit id: changed-files-since-last-remote-commit
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
since_last_remote_commit: "true" since_last_remote_commit: "true"
- name: Run changed-files using the fork point of a pull request - name: Run changed-files using the fork point of a pull request
id: changed-files-fork-point id: changed-files-fork-point
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
use_fork_point: "true" use_fork_point: "true"
- name: Run changed-files with quotepath disabled - name: Run changed-files with quotepath disabled
id: changed-files-quotepath id: changed-files-quotepath
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
quotepath: "false" quotepath: "false"
@@ -310,7 +310,7 @@ Support this project with a :star:
- name: Run changed-files with the commit of the last successful test workflow run - name: Run changed-files with the commit of the last successful test workflow run
id: changed-files-base-sha-push id: changed-files-base-sha-push
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
base_sha: ${{ steps.last_successful_commit_push.outputs.commit_hash }} base_sha: ${{ steps.last_successful_commit_push.outputs.commit_hash }}
@@ -331,20 +331,20 @@ Support this project with a :star:
- name: Run changed-files with the commit of the last successful test workflow run on main - name: Run changed-files with the commit of the last successful test workflow run on main
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
id: changed-files-base-sha-pull-request id: changed-files-base-sha-pull-request
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
base_sha: ${{ steps.last_successful_commit_pull_request.outputs.commit_hash }} base_sha: ${{ steps.last_successful_commit_pull_request.outputs.commit_hash }}
- name: Run changed-files with dir_names - name: Run changed-files with dir_names
id: changed-files-dir-names id: changed-files-dir-names
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
dir_names: "true" dir_names: "true"
# All outputs are JSON formatted arrays and can be used in other actions and matrix compatible jobs. # All outputs are JSON formatted arrays and can be used in other actions and matrix compatible jobs.
- name: Run changed-files with json output - name: Run changed-files with json output
id: changed-files-json id: changed-files-json
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
json: "true" json: "true"
``` ```
@@ -368,7 +368,7 @@ This project follows a `v(major).(patch)` versioning scheme with the exception o
> NOTE: :warning: > NOTE: :warning:
> >
> * Users referencing the legacy `v1.x.x` -> `v5.0.0` semantic versions, are required to switch over to `v10.x` -> `v15.x` respectively as new releases would no longer be deployed using the old versioning scheme. > * Users referencing the legacy `v1.x.x` `v5.0.0` semantic versions, are required to switch over to `v10.x` `v15.x` respectively as new releases would no longer be deployed using the old versioning scheme.
> * A breaking change was introduced in `v1.1.4` and `v13.x` which has been fixed. > * A breaking change was introduced in `v1.1.4` and `v13.x` which has been fixed.
## Migration guide ## Migration guide
@@ -397,7 +397,7 @@ With the switch from using grep's Extended regex to match files to the natively
- name: Get specific changed files - name: Get specific changed files
id: changed-files-specific id: changed-files-specific
uses: tj-actions/changed-files@v24.1 uses: tj-actions/changed-files@v25
with: with:
files: | files: |
*.sh *.sh
@@ -451,6 +451,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://github.com/pkit"><img src="https://avatars.githubusercontent.com/u/805654?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Constantine Peresypkin</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=pkit" title="Code">💻</a></td> <td align="center"><a href="https://github.com/pkit"><img src="https://avatars.githubusercontent.com/u/805654?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Constantine Peresypkin</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=pkit" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/deronnax"><img src="https://avatars.githubusercontent.com/u/439279?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mathieu Dupuy</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=deronnax" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/deronnax"><img src="https://avatars.githubusercontent.com/u/439279?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mathieu Dupuy</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=deronnax" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/JoeOvo"><img src="https://avatars.githubusercontent.com/u/100686542?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joe Moggridge</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=JoeOvo" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/JoeOvo"><img src="https://avatars.githubusercontent.com/u/100686542?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joe Moggridge</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=JoeOvo" title="Documentation">📖</a></td>
<td align="center"><a href="https://www.credly.com/users/thyarles/badges"><img src="https://avatars.githubusercontent.com/u/1340046?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charles Santos</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=thyarles" title="Code">💻</a></td>
</tr> </tr>
</table> </table>

View File

@@ -17,26 +17,38 @@ if [[ -n $INPUT_PATH ]]; then
cd "$REPO_DIR" cd "$REPO_DIR"
fi fi
git --version 1>/dev/null 2>&1 && exit_status=$? || exit_status=$? echo "Verifying git version..."
function __version() {
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
}
GIT_VERSION=$(git --version | awk '{print $3}'); exit_status=$?
if [[ $exit_status -ne 0 ]]; then if [[ $exit_status -ne 0 ]]; then
echo "::error::git not installed" echo "::error::git not installed"
exit 1 exit 1
fi fi
if [[ $(__version "$GIT_VERSION") -lt $(__version "2.18.0") ]]; then
echo "::error::Invalid git version. Please upgrade git ($GIT_VERSION) to >= (2.18.0)"
exit 1
else
echo "Valid git version found: ($GIT_VERSION)"
fi
echo "::debug::Getting HEAD SHA..." echo "::debug::Getting HEAD SHA..."
if [[ -z $INPUT_SHA ]]; then if [[ -z $INPUT_SHA ]]; then
CURRENT_SHA=$(git rev-list -n 1 "HEAD" 2>&1) && exit_status=$? || exit_status=$? CURRENT_SHA=$(git rev-list -n 1 "HEAD" 2>&1); exit_status=$?
else else
CURRENT_SHA=$INPUT_SHA && exit_status=$? || exit_status=$? CURRENT_SHA=$INPUT_SHA; exit_status=$?
fi fi
git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$? git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1; exit_status=$?
if [[ $exit_status -ne 0 ]]; then if [[ $exit_status -ne 0 ]]; then
echo "::error::Unable to locate the current sha: $CURRENT_SHA" echo "::error::Unable to locate the current sha: $CURRENT_SHA"
git --version
echo "::error::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage" echo "::error::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
exit 1 exit 1
else else
@@ -51,22 +63,22 @@ if [[ -z $GITHUB_BASE_REF ]]; then
if [[ -z $INPUT_BASE_SHA ]]; then if [[ -z $INPUT_BASE_SHA ]]; then
if [[ $(git rev-list --count "HEAD") -gt 1 ]]; then if [[ $(git rev-list --count "HEAD") -gt 1 ]]; then
PREVIOUS_SHA=$(git rev-parse "@~" 2>&1) && exit_status=$? || exit_status=$? PREVIOUS_SHA=$(git rev-parse "@~" 2>&1); exit_status=$?
echo "::debug::Previous SHA: $PREVIOUS_SHA" echo "::debug::Previous SHA: $PREVIOUS_SHA"
else else
PREVIOUS_SHA=$CURRENT_SHA && exit_status=$? || exit_status=$? PREVIOUS_SHA=$CURRENT_SHA; exit_status=$?
INITIAL_COMMIT="true" INITIAL_COMMIT="true"
echo "::debug::Initial commit detected" echo "::debug::Initial commit detected"
echo "::debug::Previous SHA: $PREVIOUS_SHA" echo "::debug::Previous SHA: $PREVIOUS_SHA"
fi fi
else else
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$? PREVIOUS_SHA=$INPUT_BASE_SHA; exit_status=$?
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$? TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1); exit_status=$?
echo "::debug::Previous SHA: $PREVIOUS_SHA" echo "::debug::Previous SHA: $PREVIOUS_SHA"
echo "::debug::Target branch: $TARGET_BRANCH" echo "::debug::Target branch: $TARGET_BRANCH"
fi fi
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$? git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; exit_status=$?
if [[ $exit_status -ne 0 ]]; then if [[ $exit_status -ne 0 ]]; then
echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA" echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA"
@@ -82,24 +94,24 @@ else
if [[ -z $INPUT_BASE_SHA ]]; then if [[ -z $INPUT_BASE_SHA ]]; then
if [[ "$INPUT_USE_FORK_POINT" == "true" ]]; then if [[ "$INPUT_USE_FORK_POINT" == "true" ]]; then
echo "::debug::Getting fork point..." echo "::debug::Getting fork point..."
git fetch --no-tags -u --progress origin "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? git fetch --no-tags -u --progress origin "${TARGET_BRANCH}":"${TARGET_BRANCH}"; exit_status=$?
PREVIOUS_SHA=$(git merge-base --fork-point "${TARGET_BRANCH}" "$(git name-rev --name-only "$CURRENT_SHA")") && exit_status=$? || exit_status=$? PREVIOUS_SHA=$(git merge-base --fork-point "${TARGET_BRANCH}" "$(git name-rev --name-only "$CURRENT_SHA")"); exit_status=$?
echo "::debug::Previous SHA: $PREVIOUS_SHA" echo "::debug::Previous SHA: $PREVIOUS_SHA"
else else
git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$? git fetch --no-tags -u --progress origin --depth=1 "${TARGET_BRANCH}":"${TARGET_BRANCH}"; exit_status=$?
PREVIOUS_SHA=$(git rev-list -n 1 "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$? PREVIOUS_SHA=$(git rev-list -n 1 "${TARGET_BRANCH}" 2>&1); exit_status=$?
echo "::debug::Previous SHA: $PREVIOUS_SHA" echo "::debug::Previous SHA: $PREVIOUS_SHA"
fi fi
else else
git fetch --no-tags -u --progress origin --depth=1 "$INPUT_BASE_SHA" && exit_status=$? || exit_status=$? git fetch --no-tags -u --progress origin --depth=1 "$INPUT_BASE_SHA"; exit_status=$?
PREVIOUS_SHA=$INPUT_BASE_SHA PREVIOUS_SHA=$INPUT_BASE_SHA
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$? TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1); exit_status=$?
echo "::debug::Previous SHA: $PREVIOUS_SHA" echo "::debug::Previous SHA: $PREVIOUS_SHA"
echo "::debug::Target branch: $TARGET_BRANCH" echo "::debug::Target branch: $TARGET_BRANCH"
fi fi
echo "::debug::Verifying commit SHA..." echo "::debug::Verifying commit SHA..."
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$? git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1; exit_status=$?
if [[ $exit_status -ne 0 ]]; then if [[ $exit_status -ne 0 ]]; then
echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA" echo "::error::Unable to locate the previous sha: $PREVIOUS_SHA"