Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74b06cafc9 | ||
|
|
74b3be4bf5 | ||
|
|
5ce975c602 | ||
|
|
89c8821949 | ||
|
|
bd5870c212 | ||
|
|
570b202ee2 | ||
|
|
7a453ffa2e | ||
|
|
04124efe75 | ||
|
|
6f22f2f9ba | ||
|
|
3ee6abf610 | ||
|
|
e26c03691d | ||
|
|
fa4776dd71 | ||
|
|
379de7170f | ||
|
|
23ffa77dee | ||
|
|
fdbd13bcad | ||
|
|
23e3c4300c | ||
|
|
063e674726 | ||
|
|
62102d8eaa |
2
.github/workflows/auto-merge.yml
vendored
2
.github/workflows/auto-merge.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
github.actor == 'renovate'
|
||||
steps:
|
||||
- name: automerge
|
||||
uses: pascalgn/automerge-action@v0.15.5
|
||||
uses: pascalgn/automerge-action@v0.15.6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
|
||||
MERGE_METHOD: "rebase"
|
||||
|
||||
2
.github/workflows/codacy-analysis.yml
vendored
2
.github/workflows/codacy-analysis.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
continue-on-error: true
|
||||
uses: codacy/codacy-analysis-cli-action@v4.2.0
|
||||
uses: codacy/codacy-analysis-cli-action@v4.3.0
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
|
||||
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -342,12 +342,15 @@ jobs:
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
fetch-depth: [0, 1]
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: recursive
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Run changed-files with submodule
|
||||
id: changed-files
|
||||
|
||||
122
HISTORY.md
122
HISTORY.md
@@ -1,16 +1,90 @@
|
||||
# Changelog
|
||||
|
||||
## [v35.5.4](https://github.com/tj-actions/changed-files/tree/v35.5.4) (2023-02-16)
|
||||
## [v35.6.2](https://github.com/tj-actions/changed-files/tree/v35.6.2) (2023-03-09)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35...v35.5.4)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35...v35.6.2)
|
||||
|
||||
## [v35](https://github.com/tj-actions/changed-files/tree/v35) (2023-02-16)
|
||||
## [v35](https://github.com/tj-actions/changed-files/tree/v35) (2023-03-09)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.3...v35)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.6.1...v35)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Compare the Last Remote SHA and Head SHA of a Git Branch? [\#1006](https://github.com/tj-actions/changed-files/issues/1006)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: fetching history for pr made from a fork with checkout set to the target repository [\#1007](https://github.com/tj-actions/changed-files/pull/1007) ([jackton1](https://github.com/jackton1))
|
||||
- chore\(deps\): update codacy/codacy-analysis-cli-action action to v4.3.0 [\#1005](https://github.com/tj-actions/changed-files/pull/1005) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v35.6.1 [\#1004](https://github.com/tj-actions/changed-files/pull/1004) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.6.1](https://github.com/tj-actions/changed-files/tree/v35.6.1) (2023-02-28)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.6.0...v35.6.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Add support for listing deleted submodules [\#999](https://github.com/tj-actions/changed-files/issues/999)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- feat: pull submodule history for pull request events [\#1003](https://github.com/tj-actions/changed-files/pull/1003) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.6.0 [\#1002](https://github.com/tj-actions/changed-files/pull/1002) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.6.0](https://github.com/tj-actions/changed-files/tree/v35.6.0) (2023-02-26)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.6...v35.6.0)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Running on PR doesn't get the correct head sha [\#998](https://github.com/tj-actions/changed-files/issues/998)
|
||||
- \[BUG\] action fails when with a Git tag instead of branch [\#995](https://github.com/tj-actions/changed-files/issues/995)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- feat: add support for listing deleted submodules. [\#1001](https://github.com/tj-actions/changed-files/pull/1001) ([jackton1](https://github.com/jackton1))
|
||||
- fix: readme typo [\#1000](https://github.com/tj-actions/changed-files/pull/1000) ([benhammondmusic](https://github.com/benhammondmusic))
|
||||
- Upgraded to v35.5.6 [\#997](https://github.com/tj-actions/changed-files/pull/997) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.5.6](https://github.com/tj-actions/changed-files/tree/v35.5.6) (2023-02-20)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.5...v35.5.6)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Watch multiple paths [\#993](https://github.com/tj-actions/changed-files/issues/993)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: error fetch remote ref when using fetch depth of 1 [\#996](https://github.com/tj-actions/changed-files/pull/996) ([jackton1](https://github.com/jackton1))
|
||||
- chore\(deps\): update pascalgn/automerge-action action to v0.15.6 [\#994](https://github.com/tj-actions/changed-files/pull/994) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v35.5.5 [\#991](https://github.com/tj-actions/changed-files/pull/991) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.5.5](https://github.com/tj-actions/changed-files/tree/v35.5.5) (2023-02-16)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.4...v35.5.5)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Changes are retrieved for everything since initial commit, instead of the current context like the GitHub UI [\#990](https://github.com/tj-actions/changed-files/issues/990)
|
||||
- \[BUG\] "unknown revision" when using "path" [\#987](https://github.com/tj-actions/changed-files/issues/987)
|
||||
- \[BUG\] Failing to retrieve master branch if depth isn't 0 [\#988](https://github.com/tj-actions/changed-files/issues/988)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: bug with fetching history [\#989](https://github.com/tj-actions/changed-files/pull/989) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.5.4 [\#986](https://github.com/tj-actions/changed-files/pull/986) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.5.4](https://github.com/tj-actions/changed-files/tree/v35.5.4) (2023-02-16)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.3...v35.5.4)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Failing to retrieve master branch if depth isn't 0 [\#985](https://github.com/tj-actions/changed-files/issues/985)
|
||||
- \[BUG\] action fail with pull request from external branch called master [\#979](https://github.com/tj-actions/changed-files/issues/979)
|
||||
- \[BUG\] fatal: Invalid revision range X..Y when dealing with submodules [\#978](https://github.com/tj-actions/changed-files/issues/978)
|
||||
|
||||
@@ -79,10 +153,6 @@
|
||||
- \[BUG\] PR between branch and main - unsynced changes appearing in changed files. [\#966](https://github.com/tj-actions/changed-files/issues/966)
|
||||
- ::error::Failed to get current commit for submodule [\#962](https://github.com/tj-actions/changed-files/issues/962)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Updated README.md [\#968](https://github.com/tj-actions/changed-files/pull/968) ([jackton1](https://github.com/jackton1))
|
||||
@@ -745,7 +815,7 @@
|
||||
|
||||
## [v34.0.0](https://github.com/tj-actions/changed-files/tree/v34.0.0) (2022-10-25)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v33...v34.0.0)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v33.0.0...v34.0.0)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
@@ -758,13 +828,13 @@
|
||||
- feat: add support for fetching more history [\#709](https://github.com/tj-actions/changed-files/pull/709) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v33.0.0 [\#707](https://github.com/tj-actions/changed-files/pull/707) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v33](https://github.com/tj-actions/changed-files/tree/v33) (2022-10-21)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v33.0.0...v33)
|
||||
|
||||
## [v33.0.0](https://github.com/tj-actions/changed-files/tree/v33.0.0) (2022-10-21)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v32.1.2...v33.0.0)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v33...v33.0.0)
|
||||
|
||||
## [v33](https://github.com/tj-actions/changed-files/tree/v33) (2022-10-21)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v32.1.2...v33)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
@@ -902,7 +972,7 @@
|
||||
|
||||
## [v31.0.0](https://github.com/tj-actions/changed-files/tree/v31.0.0) (2022-09-25)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v30...v31.0.0)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v30.0.0...v31.0.0)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
@@ -915,13 +985,13 @@
|
||||
- chore: update broken link [\#642](https://github.com/tj-actions/changed-files/pull/642) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v30.0.0 [\#641](https://github.com/tj-actions/changed-files/pull/641) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v30](https://github.com/tj-actions/changed-files/tree/v30) (2022-09-24)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v30.0.0...v30)
|
||||
|
||||
## [v30.0.0](https://github.com/tj-actions/changed-files/tree/v30.0.0) (2022-09-24)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.9...v30.0.0)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v30...v30.0.0)
|
||||
|
||||
## [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)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
@@ -937,13 +1007,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.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...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)
|
||||
[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)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
|
||||
26
README.md
26
README.md
@@ -15,7 +15,7 @@
|
||||
|
||||
## changed-files
|
||||
|
||||
Retrieve all changed files and directories relative to the target branch or the last remote commit returning the **relative path** from the project root.
|
||||
Retrieve all changed files and directories relative to the target branch or the last remote commit returning a **relative path** from the project root.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -23,11 +23,11 @@ Retrieve all changed files and directories relative to the target branch or the
|
||||
* Easy to debug.
|
||||
* Scales to large repositories.
|
||||
* Supports Git submodules.
|
||||
* Escaped JSON output which can be used for running matrix jobs based on changed files.
|
||||
* Escaped JSON output which can be used to run matrix jobs based on changed files.
|
||||
* List changed directories.
|
||||
* Restrict the max depth of changed directories.
|
||||
* Write outputs to files at a specified location for further processing.
|
||||
* Monorepos (Fetches only the last remote commit).
|
||||
* Monorepos (Fetches a fixed number of commits).
|
||||
* Supports all platforms (Linux, MacOS, Windows).
|
||||
* [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners) support
|
||||
* [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.3/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server) support.
|
||||
@@ -48,20 +48,16 @@ Retrieve all changed files and directories relative to the target branch or the
|
||||
> * **IMPORTANT:** For `push` events you need to include `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case.
|
||||
> * For monorepos where pulling all the branch history might not be desired, you can omit `fetch-depth` for `pull_request` events.
|
||||
> * For files located in a sub-directory ensure that the pattern specified contains `**/` (globstar) to match any preceding directories or explicitly pass the full path relative to the project root. See: [#314](https://github.com/tj-actions/changed-files/issues/314).
|
||||
> * All multiline inputs should not use double or single qoutes since the value is already a string seperated by a newline character. See [Examples](#examples) for more information.
|
||||
> * All multiline inputs should not use double or single quotes since the value is already a string seperated by a newline character. See [Examples](#examples) for more information.
|
||||
> * Ensure that `persist-credentials` is set to `true` when configuring `actions/checkout` if `fetch-depth` isn't set to `0`.
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
|
||||
on:
|
||||
# Compare the preceeding commit -> to the current commit of the main branch.
|
||||
# (Note: To compare changes between the current commit to the last pushed remote commit of the main branch set `since_last_remote_commit: true`)
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
# Compare the last commit of main -> to the current commit of a PR branch.
|
||||
# (Note: To compare changes between the current commit to the last pushed remote commit of a PR branch set `since_last_remote_commit: true`)
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -79,6 +75,13 @@ jobs:
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
# -------------------------------------------------------------------------------------------------------------------------
|
||||
# Event `push`: Compare the preceeding commit -> to the current commit of the main branch.
|
||||
# Event `pull_request`: Compare the last commit of main -> to the current commit of a Pull Request branch.
|
||||
# -------------------------------------------------------------------------------------------------------------------------
|
||||
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
|
||||
# with:
|
||||
# since_last_remote_commit: true
|
||||
|
||||
- name: List all changed files
|
||||
run: |
|
||||
@@ -439,16 +442,9 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Base SHA
|
||||
id: get-base-sha
|
||||
run: |
|
||||
echo "base_sha=$(git rev-parse "$(git tag --sort=-v:refname | head -n 2 | tail -n 1)")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
|
||||
|
||||
- name: Get changed files in the .github folder
|
||||
id: changed-files-specific
|
||||
|
||||
@@ -187,6 +187,7 @@ runs:
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
GITHUB_WORKSPACE: ${{ github.workspace }}
|
||||
GITHUB_EVENT_BASE_REF: ${{ github.event.base_ref }}
|
||||
GITHUB_EVENT_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }}
|
||||
GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
|
||||
GITHUB_EVENT_PULL_REQUEST_BASE_REF: ${{ github.event.pull_request.base.ref }}
|
||||
|
||||
53
diff-sha.sh
53
diff-sha.sh
@@ -9,10 +9,12 @@ PREVIOUS_SHA=""
|
||||
CURRENT_SHA=""
|
||||
DIFF="..."
|
||||
IS_TAG="false"
|
||||
SOURCE_BRANCH=""
|
||||
|
||||
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
|
||||
IS_TAG="true"
|
||||
EXTRA_ARGS="--prune --no-recurse-submodules"
|
||||
SOURCE_BRANCH=${GITHUB_EVENT_BASE_REF#refs/heads/}
|
||||
fi
|
||||
|
||||
if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF || "$GITHUB_EVENT_HEAD_REPO_FORK" == "true" ]]; then
|
||||
@@ -52,17 +54,32 @@ else
|
||||
echo "Valid git version found: ($GIT_VERSION)"
|
||||
fi
|
||||
|
||||
IS_SHALLOW=$(git rev-parse --is-shallow-repository) && exit_status=$? || exit_status=$?
|
||||
|
||||
if [[ $exit_status -ne 0 ]]; then
|
||||
echo "::error::Unable to determine if the repository is shallow"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
||||
echo "Running on a push event..."
|
||||
TARGET_BRANCH=$GITHUB_REFNAME
|
||||
CURRENT_BRANCH=$TARGET_BRANCH
|
||||
|
||||
if $(git rev-parse --is-shallow-repository); then
|
||||
if [[ "$IS_SHALLOW" == "true" ]]; then
|
||||
echo "Fetching remote refs..."
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$CURRENT_BRANCH":refs/remotes/origin/"$CURRENT_BRANCH" 1>/dev/null
|
||||
# shellcheck disable=SC2086
|
||||
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
|
||||
if [[ "$IS_TAG" == "false" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$CURRENT_BRANCH":refs/remotes/origin/"$CURRENT_BRANCH" 1>/dev/null
|
||||
elif [[ "$SOURCE_BRANCH" != "" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$SOURCE_BRANCH":refs/remotes/origin/"$SOURCE_BRANCH" 1>/dev/null
|
||||
fi
|
||||
|
||||
if git submodule status &>/dev/null; then
|
||||
# shellcheck disable=SC2086
|
||||
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Getting HEAD SHA..."
|
||||
@@ -102,6 +119,13 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
||||
echo "::error::Unable to locate a previous commit for the specified date: $INPUT_SINCE"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$IS_TAG" == "true" ]]; then
|
||||
PREVIOUS_SHA=$(git rev-parse "$(git tag --sort=-v:refname | head -n 2 | tail -n 1)") && exit_status=$? || exit_status=$?
|
||||
|
||||
if [[ -z "$PREVIOUS_SHA" ]]; then
|
||||
echo "::error::Unable to locate a previous commit for the specified tag: $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" == "true" ]]; then
|
||||
PREVIOUS_SHA=""
|
||||
@@ -162,10 +186,16 @@ else
|
||||
TARGET_BRANCH=$CURRENT_BRANCH
|
||||
fi
|
||||
|
||||
if $(git rev-parse --is-shallow-repository); then
|
||||
if [[ "$IS_SHALLOW" == "true" ]]; then
|
||||
echo "Fetching remote refs..."
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
|
||||
|
||||
if [[ "$GITHUB_EVENT_HEAD_REPO_FORK" != "true" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$CURRENT_BRANCH"*:refs/remotes/origin/"$CURRENT_BRANCH"* 1>/dev/null
|
||||
fi
|
||||
|
||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" != "true" ]]; then
|
||||
echo "::debug::Fetching remote target branch..."
|
||||
@@ -173,6 +203,11 @@ else
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null
|
||||
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null || true
|
||||
fi
|
||||
|
||||
if git submodule status &>/dev/null; then
|
||||
# shellcheck disable=SC2086
|
||||
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Getting HEAD SHA..."
|
||||
@@ -213,7 +248,7 @@ else
|
||||
else
|
||||
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
||||
|
||||
if $(git rev-parse --is-shallow-repository); then
|
||||
if [[ "$IS_SHALLOW" == "true" ]]; then
|
||||
# check if the merge base is in the local history
|
||||
if ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
echo "::debug::Merge base is not in the local history, fetching remote target branch..."
|
||||
|
||||
@@ -91,7 +91,13 @@ function get_diff() {
|
||||
echo "::warning::Failed to get changed files for submodule ($sub) between: ${sub_commit_pre:-4b825dc642cb6eb9a060e54bf8d69288fbee4904} ${sub_commit_cur}. Please ensure that submodules are initialized and up to date. See: https://github.com/actions/checkout#usage" >&2
|
||||
}
|
||||
fi
|
||||
done < <(git submodule | awk '{print $2}')
|
||||
done < <(git submodule status --recursive | grep -v "^-" | awk '{print $2}')
|
||||
|
||||
if [[ "$filter" == "D" ]]; then
|
||||
while read -r sub; do
|
||||
echo "$sub"
|
||||
done < <(git submodule status --recursive | grep -e "^-" | awk '{print $2}')
|
||||
fi
|
||||
|
||||
git diff --diff-filter="$filter" --name-only --ignore-submodules=all "$base$DIFF$sha" && exit_status=$? || exit_status=$?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user