Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
300e935beb | ||
|
|
d188a8e7a1 | ||
|
|
5653483733 | ||
|
|
bdd3bf886a | ||
|
|
a0301e7e4d | ||
|
|
23c8cafe35 | ||
|
|
8a7dfe02e7 | ||
|
|
c7eb6e4282 | ||
|
|
40dc6382c6 | ||
|
|
fd5dd8e5ad | ||
|
|
d6f3673f2e | ||
|
|
9864173ab1 | ||
|
|
2bcefe21d5 | ||
|
|
fcb2ab8c32 | ||
|
|
8e1fd96840 | ||
|
|
db67c2c65f | ||
|
|
1137222c33 | ||
|
|
1378377c4f | ||
|
|
461fb0a676 | ||
|
|
eacc417146 | ||
|
|
86c6017967 | ||
|
|
95ef6d6cbd | ||
|
|
bca6aacc45 | ||
|
|
79272641ee | ||
|
|
168ea27d9c | ||
|
|
3d12540806 | ||
|
|
b1f6992ec2 | ||
|
|
1e435854e3 | ||
|
|
fdc23e7274 | ||
|
|
7841015a94 | ||
|
|
932c8a5c11 | ||
|
|
41c5eb7faa | ||
|
|
858bda29ab | ||
|
|
570809f09a | ||
|
|
1f7183322d | ||
|
|
254f56230a | ||
|
|
5b98ea4364 | ||
|
|
ce0e219f00 | ||
|
|
6c57b11941 | ||
|
|
ca0dcf8458 | ||
|
|
dc2959d455 | ||
|
|
085386c38b | ||
|
|
43245574e6 | ||
|
|
a9b4a3786b | ||
|
|
1429c1a023 | ||
|
|
678cfad1af | ||
|
|
a35fe66804 | ||
|
|
33024fa8e2 | ||
|
|
b88d273a4d | ||
|
|
5496c5f1b0 | ||
|
|
c306da633c | ||
|
|
6a0c3909aa | ||
|
|
59919b746c | ||
|
|
cb1a80f76a | ||
|
|
10f1fffaf6 | ||
|
|
801d25f3b0 | ||
|
|
38710bc67f | ||
|
|
357e1be510 | ||
|
|
c3105e7432 | ||
|
|
c7d680f31b | ||
|
|
e6d9964230 | ||
|
|
177ed75445 | ||
|
|
e2b2194939 | ||
|
|
1ef8c96245 | ||
|
|
271bbd60fe | ||
|
|
e629b8ea3a | ||
|
|
f048489251 |
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
6
.github/workflows/auto-approve.yml
vendored
6
.github/workflows/auto-approve.yml
vendored
@@ -14,6 +14,10 @@ jobs:
|
||||
github.actor == 'dependabot-preview[bot]' ||
|
||||
github.actor == 'dependabot-preview' ||
|
||||
github.actor == 'renovate[bot]' ||
|
||||
github.actor == 'renovate'
|
||||
github.actor == 'renovate' ||
|
||||
github.actor == 'pyup-bot' ||
|
||||
github.actor == 'github-actions[bot]' ||
|
||||
github.actor == 'pre-commit-ci' ||
|
||||
github.actor == 'pre-commit-ci[bot]'
|
||||
with:
|
||||
github-token: ${{ secrets.PAT_TOKEN }}
|
||||
|
||||
4
.github/workflows/sync-release-version.yml
vendored
4
.github/workflows/sync-release-version.yml
vendored
@@ -12,14 +12,14 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Sync release version.
|
||||
uses: tj-actions/sync-release-version@v8
|
||||
uses: tj-actions/sync-release-version@v8.5
|
||||
id: sync-release-version
|
||||
with:
|
||||
pattern: '${{ github.repository }}@'
|
||||
paths: |
|
||||
README.md
|
||||
- name: Generate CHANGELOG
|
||||
uses: tj-actions/github-changelog-generator@v1.3
|
||||
uses: tj-actions/github-changelog-generator@v1.6
|
||||
with:
|
||||
output: 'HISTORY.md'
|
||||
- name: Create Pull Request
|
||||
|
||||
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@@ -40,3 +40,24 @@ jobs:
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"
|
||||
- name: Run changed-files with specific files
|
||||
id: changed-files-specific
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
action.yml
|
||||
.github/workflows/test.yml
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
||||
- name: Run changed-files with specific files comma separator
|
||||
id: changed-files-specific-comma
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
action.yml
|
||||
.github/workflows/test.yml
|
||||
separator: ","
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific-comma.outputs) }}"
|
||||
|
||||
38
HISTORY.md
38
HISTORY.md
@@ -1,5 +1,43 @@
|
||||
# Changelog
|
||||
|
||||
## [v4.3](https://github.com/tj-actions/changed-files/tree/v4.3) (2021-05-01)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.2...v4.3)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- fatal error when using @v4.2 [\#28](https://github.com/tj-actions/changed-files/issues/28)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
- Add support for watching a subset of files. [\#20](https://github.com/tj-actions/changed-files/issues/20)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Add support to filter only specific files [\#31](https://github.com/tj-actions/changed-files/pull/31) ([jackton1](https://github.com/jackton1))
|
||||
- Bump tj-actions/sync-release-version from v8 to v8.5 [\#30](https://github.com/tj-actions/changed-files/pull/30) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Upgrade to GitHub-native Dependabot [\#29](https://github.com/tj-actions/changed-files/pull/29) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
||||
- Update tj-actions/github-changelog-generator action to v1.6 [\#26](https://github.com/tj-actions/changed-files/pull/26) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update README.md [\#25](https://github.com/tj-actions/changed-files/pull/25) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v4.2 [\#24](https://github.com/tj-actions/changed-files/pull/24) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v4.2](https://github.com/tj-actions/changed-files/tree/v4.2) (2021-04-23)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.1...v4.2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v4.1 [\#23](https://github.com/tj-actions/changed-files/pull/23) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v4.1](https://github.com/tj-actions/changed-files/tree/v4.1) (2021-04-23)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4...v4.1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v4 [\#22](https://github.com/tj-actions/changed-files/pull/22) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v4](https://github.com/tj-actions/changed-files/tree/v4) (2021-04-23)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.3...v4)
|
||||
|
||||
180
README.md
180
README.md
@@ -6,9 +6,59 @@ changed-files
|
||||
Get all modified files relative to the default branch or preceding commit.
|
||||
|
||||
|
||||
## Features
|
||||
- List all files that have changed .
|
||||
- List only a subset of files that can be used to detect changes.
|
||||
- Report on a subset of files that have all change.
|
||||
- Report on a subset of files that have at least one file change.
|
||||
- Regex pattern matching on a subset of files.
|
||||
|
||||
|
||||
## Outputs
|
||||
|
||||
Using the default separator.
|
||||
|
||||
| Acronym | Meaning |
|
||||
|:---------:|:------------:|
|
||||
| A | Added |
|
||||
| C | Copied |
|
||||
| M | Modified. |
|
||||
| D | Deleted |
|
||||
| R | Renamed |
|
||||
| T | Type changed |
|
||||
| U | Unmerged |
|
||||
| X | Unknown |
|
||||
|
||||
|
||||
| Output | type | example | description |
|
||||
|:-------------------:|:------------:|:------------------------------:|:----------------------------------------:|
|
||||
| all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* |
|
||||
| all_changed | `string` | `true OR false` | Returns `true` only when the filenames provided using `files` input have all changed |
|
||||
| all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options below.* |
|
||||
| added_files | `string` | 'new.txt other.png ...' | Select only files that are Added (A) |
|
||||
| copied_files | `string` | 'new.txt other.png ...' | Select only files that are Copied (C) |
|
||||
| deleted_files | `string` | 'new.txt other.png ...' | Select only files that are Deleted (D) |
|
||||
| modified_files | `string` | 'new.txt other.png ...' | Select only files that are Modified (M) |
|
||||
| renamed_files | `string` | 'new.txt other.png ...' | Select only files that are Renamed (R) |
|
||||
| changed_files | `string` | 'new.txt other.png ...' | Select only files that have their file type changed (T) |
|
||||
| unmerged_files | `string` | 'new.txt other.png ...' | Select only files that are Unmerged (U) |
|
||||
| unknown_files | `string` | 'new.txt other.png ...' | Select only files that are Unknown (X) |
|
||||
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | type | required | default | description |
|
||||
|:-------------:|:-----------:|:-------------:|:----------------------------:|:-------------:|
|
||||
| separator | `string` | `true` | `' '` | Separator to return outputs |
|
||||
| files | `string OR string[]` | `false` | | Restricted list of specific files to watch for changes |
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Push event
|
||||
> NOTE: :warning:
|
||||
> * For `push` events to work you need to include `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case.
|
||||
|
||||
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
@@ -17,6 +67,9 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -26,31 +79,16 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
|
||||
|
||||
- name: Get changed files
|
||||
id: changed_files
|
||||
uses: tj-actions/changed-files@v4
|
||||
```
|
||||
|
||||
|
||||
### Pull Request events
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test changed-files
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Get changed files
|
||||
id: changed_files
|
||||
uses: tj-actions/changed-files@v4
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v4.3
|
||||
|
||||
- name: List all modified files
|
||||
run: |
|
||||
for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do
|
||||
echo "$file was modified"
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
@@ -61,31 +99,48 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Get changed files using defaults
|
||||
id: changed_files
|
||||
uses: tj-actions/changed-files@v4
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v4.3
|
||||
|
||||
- name: Get changed files using a comma separator
|
||||
id: changed_files_comma
|
||||
uses: tj-actions/changed-files@v4
|
||||
id: changed-files-comma
|
||||
uses: tj-actions/changed-files@v4.3
|
||||
with:
|
||||
separator: ","
|
||||
|
||||
|
||||
- name: List all added files
|
||||
run: |
|
||||
for file in "${{ steps.changed_files.outputs.added_files }}"; do
|
||||
echo $file
|
||||
for file in "${{ steps.changed-files.outputs.added_files }}"; do
|
||||
echo "$file was added"
|
||||
done
|
||||
|
||||
- name: Run step when a file changes in a PR relative to the default branch
|
||||
if: contains(steps.changed_files.outputs.modified_files, 'my-file.txt')
|
||||
run: |
|
||||
echo "Your file my-file.txt has been modified."
|
||||
|
||||
- name: Run step when a file is deleted in a PR relative to the default branch
|
||||
if: contains(steps.changed_files.outputs.deleted_files, 'test.txt')
|
||||
- name: Run step when a file changes
|
||||
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
|
||||
run: |
|
||||
echo "Your test.txt has been deleted."
|
||||
|
||||
echo "Your file my-file.txt has been modified."
|
||||
|
||||
- name: Run step when a file has been deleted
|
||||
if: contains(steps.changed-files.outputs.deleted_files, 'test.txt')
|
||||
run: |
|
||||
echo "Your test.txt has been deleted."
|
||||
|
||||
- name: Get specific changed files
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v4.2
|
||||
with:
|
||||
files: |
|
||||
my-file.txt
|
||||
test.txt
|
||||
new.txt
|
||||
test_directory
|
||||
.(py|jpeg)$
|
||||
.(sql)$
|
||||
^(mynewfile|custom)
|
||||
|
||||
- name: Run step if all files listed above have changed
|
||||
if: steps.changed-files-specific.outputs.all_changed
|
||||
run: |
|
||||
echo "Both my-file.txt and test.txt have changed."
|
||||
|
||||
```
|
||||
|
||||
@@ -99,41 +154,17 @@ jobs:
|
||||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||
|
||||
- name: Get changed files
|
||||
id: changed_files
|
||||
uses: tj-actions/changed-files@v4
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v4.3
|
||||
|
||||
- name: Pre-commit
|
||||
uses: pre-commit/action@v2.0.0
|
||||
with:
|
||||
extra_args: -v --hook-stage push --files ${{ steps.changed_files.outputs.all_modified_files }}
|
||||
extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_modified_files }}
|
||||
token: ${{ secrets.github_token }}
|
||||
```
|
||||
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | type | required | default | description |
|
||||
|:-------------:|:-----------:|:-------------:|:----------------------------:|:-------------:|
|
||||
| separator | `string` | `true` | `' '` | Separator to return outputs |
|
||||
|
||||
|
||||
|
||||
## Outputs
|
||||
|
||||
Using the default separator.
|
||||
|
||||
| Output | type | example | description |
|
||||
|:-------------------:|:------------:|:------------------------------:|:----------------------------------------:|
|
||||
| added_files | `string` | 'new.txt other.png ...' | Select only files that are Added (A) |
|
||||
| copied_files | `string` | 'new.txt other.png ...' | Select only files that are Copied (C) |
|
||||
| deleted_files | `string` | 'new.txt other.png ...' | Select only files that are Deleted (D) |
|
||||
| modified_files | `string` | 'new.txt other.png ...' | Select only files that are Modified (M) |
|
||||
| renamed_files | `string` | 'new.txt other.png ...' | Select only files that are Renamed (R) |
|
||||
| changed_files | `string` | 'new.txt other.png ...' | Select only files that have their type changed (T) |
|
||||
| unmerged_files | `string` | 'new.txt other.png ...' | Select only files that are Unmerged (U) |
|
||||
| unknown_files | `string` | 'new.txt other.png ...' | Select only files that are Unknown (X) |
|
||||
| all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options above.* |
|
||||
| all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* |
|
||||
|
||||
|
||||
## Example
|
||||
@@ -145,19 +176,6 @@ Using the default separator.
|
||||
* Free software: [MIT license](LICENSE)
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
- Added Files
|
||||
- Copied Files
|
||||
- Deleted Files
|
||||
- Modified Files
|
||||
- Renamed Files
|
||||
- Changed Files
|
||||
- Unmerged Files
|
||||
- Unknown Files
|
||||
- All Changed Files
|
||||
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
|
||||
98
action.yml
98
action.yml
@@ -6,6 +6,10 @@ inputs:
|
||||
description: 'Split character for array output'
|
||||
required: true
|
||||
default: " "
|
||||
files:
|
||||
description: 'Check for file changes for all files listed (Defaults to the entire repo)'
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
outputs:
|
||||
added_files:
|
||||
@@ -38,6 +42,12 @@ outputs:
|
||||
all_modified_files:
|
||||
description: List of all copied modified and added files
|
||||
value: ${{ steps.changed_files.outputs.all_modified_files }}
|
||||
all_changed:
|
||||
description: Return true only when all files provided using the files input have all changed.
|
||||
value: ${{ steps.changed_files.outputs.all_changed }}
|
||||
any_changed:
|
||||
description: Return true only when any files provided using the files input have changed.
|
||||
value: ${{ steps.changed_files.outputs.any_changed }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -53,20 +63,80 @@ runs:
|
||||
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
||||
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true)
|
||||
fi
|
||||
|
||||
echo "Getting diff..."
|
||||
ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
COPIED=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
DELETED=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
MODIFIED=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
RENAMED=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
CHANGED=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
UNMERGED=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
ALL_CHANGED=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
ALL_MODIFIED_FILES=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
|
||||
|
||||
INPUT_FILES="${{ inputs.files }}"
|
||||
|
||||
if [[ -z "$INPUT_FILES" ]]; then
|
||||
|
||||
echo "Getting diff..."
|
||||
|
||||
ADDED=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
COPIED=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
DELETED=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
MODIFIED=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
RENAMED=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
CHANGED=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
UNMERGED=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
ALL_CHANGED=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
ALL_MODIFIED_FILES=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
else
|
||||
ADDED=()
|
||||
COPIED=()
|
||||
DELETED=()
|
||||
MODIFIED=()
|
||||
RENAMED=()
|
||||
CHANGED=()
|
||||
UNMERGED=()
|
||||
UNKNOWN=()
|
||||
ALL_CHANGED=()
|
||||
ALL_MODIFIED_FILES=()
|
||||
|
||||
for path in ${INPUT_FILES}
|
||||
do
|
||||
echo "Checking for file changes: \"${path}\"..."
|
||||
ADDED+=$(git diff --diff-filter=A --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
COPIED+=$(git diff --diff-filter=C --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
DELETED+=$(git diff --diff-filter=D --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
MODIFIED+=$(git diff --diff-filter=M --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
RENAMED+=$(git diff --diff-filter=R --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
CHANGED+=$(git diff --diff-filter=T --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
UNMERGED+=$(git diff --diff-filter=U --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
UNKNOWN+=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
ALL_CHANGED+=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
ALL_MODIFIED_FILES+=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | grep -E "(${path})" | xargs printf "%s${{ inputs.separator }}" || true)
|
||||
done
|
||||
|
||||
ADDED=$(echo "$ADDED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
COPIED=$(echo $COPIED | sed -E 's/(${{ inputs.separator }})$//')
|
||||
DELETED=$(echo "$DELETED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
MODIFIED=$(echo "$MODIFIED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
RENAMED=$(echo "$RENAMED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
CHANGED=$(echo "$CHANGED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
UNMERGED=$(echo "$UNMERGED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
UNKNOWN=$(echo "$UNKNOWN" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
ALL_CHANGED=$(echo "$ALL_CHANGED" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
ALL_MODIFIED_FILES=$(echo "$ALL_MODIFIED_FILES" | sed -E 's/(${{ inputs.separator }})$//')
|
||||
|
||||
OUTPUT_ALL_MODIFIED_FILES=$(echo $ALL_MODIFIED_FILES | sed "s/${{ inputs.separator }}/ /g")
|
||||
ALL_INPUT_FILES=$(echo $INPUT_FILES | sed "s/\n/ /g")
|
||||
|
||||
IFS=$' ' SORTED_INPUT_FILES=($(sort <<<"${ALL_INPUT_FILES[*]}"))
|
||||
IFS=$' ' SORTED_OUTPUT_ALL_MODIFIED_FILES=($(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}"))
|
||||
|
||||
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then
|
||||
echo "::set-output name=all_changed::true"
|
||||
else
|
||||
echo "::set-output name=all_changed::false"
|
||||
fi
|
||||
|
||||
if [[ ${#SORTED_OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then
|
||||
echo "::set-output name=any_changed::true"
|
||||
else
|
||||
echo "::set-output name=any_changed::false"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::set-output name=added_files::$ADDED"
|
||||
echo "::set-output name=copied_files::$COPIED"
|
||||
echo "::set-output name=deleted_files::$DELETED"
|
||||
@@ -80,5 +150,5 @@ runs:
|
||||
shell: bash
|
||||
|
||||
branding:
|
||||
icon: list
|
||||
icon: file-text
|
||||
color: white
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"packageRules": [
|
||||
{
|
||||
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
|
||||
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest"],
|
||||
"automerge": true,
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
@@ -33,7 +33,7 @@
|
||||
"matchLanguages": [
|
||||
"docker"
|
||||
],
|
||||
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
|
||||
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest"],
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"automerge"
|
||||
@@ -41,4 +41,4 @@
|
||||
"automerge": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user