Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7394701157 | ||
|
|
234423e82b | ||
|
|
f834a938f2 | ||
|
|
d2bf1ba9cd | ||
|
|
8ec2566464 | ||
|
|
7dd9711c64 | ||
|
|
0c7f7d1ce7 | ||
|
|
abfa34ddb6 | ||
|
|
6d5cf3f952 | ||
|
|
5f910fc7e7 | ||
|
|
dd75630a57 | ||
|
|
9014219205 |
@@ -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,
|
||||||
|
|||||||
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -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
|
||||||
|
|||||||
21
HISTORY.md
21
HISTORY.md
@@ -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)
|
||||||
|
|||||||
39
README.md
39
README.md
@@ -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 -->
|
||||||
|
|
||||||
[](#contributors-)
|
[](#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>
|
||||||
|
|
||||||
|
|||||||
46
diff-sha.sh
46
diff-sha.sh
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user