Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
e8ace0110c | ||
|
|
e83c52fc11 | ||
|
|
853caa603d | ||
|
|
17e2510d74 | ||
|
|
e858c485a2 | ||
|
|
19483649c5 | ||
|
|
c061ef1fa3 | ||
|
|
84fd7c7a42 | ||
|
|
af5a2e5d10 | ||
|
|
e8f8d088f6 | ||
|
|
c23398e584 | ||
|
|
9352b30cc3 | ||
|
|
7b1f7ad57b | ||
|
|
e368753cac | ||
|
|
b47ed0ffe6 | ||
|
|
0e1d04f780 | ||
|
|
814a7ea227 | ||
|
|
4420c3c441 | ||
|
|
feadcbc861 | ||
|
|
b60f5e56b6 | ||
|
|
489e2d514f | ||
|
|
d889202b3a | ||
|
|
9ec430d951 | ||
|
|
ca2815e08c | ||
|
|
120ceacaf7 | ||
|
|
d205273c8b | ||
|
|
cc55e77a98 | ||
|
|
64fdc4478a | ||
|
|
669bce6c25 |
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
|
||||
|
||||
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
@@ -1,6 +1,9 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -12,6 +15,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Run changed-files with defaults
|
||||
id: changed-files
|
||||
uses: ./
|
||||
@@ -35,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) }}"
|
||||
|
||||
41
CHANGELOG.md
41
CHANGELOG.md
@@ -1,41 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## [v3](https://github.com/tj-actions/changed-files/tree/v3) (2021-04-02)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.1...v3)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Update action.yml [\#11](https://github.com/tj-actions/changed-files/pull/11) ([jackton1](https://github.com/jackton1))
|
||||
- Update README.md [\#10](https://github.com/tj-actions/changed-files/pull/10) ([jackton1](https://github.com/jackton1))
|
||||
- Configure Renovate [\#9](https://github.com/tj-actions/changed-files/pull/9) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update test.yml [\#8](https://github.com/tj-actions/changed-files/pull/8) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v2.1 [\#6](https://github.com/tj-actions/changed-files/pull/6) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v2.1](https://github.com/tj-actions/changed-files/tree/v2.1) (2021-03-18)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2...v2.1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v2](https://github.com/tj-actions/changed-files/tree/v2) (2021-03-14)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1...v2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixed end of string with separator [\#4](https://github.com/tj-actions/changed-files/pull/4) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v1](https://github.com/tj-actions/changed-files/tree/v1) (2021-03-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/7eba13b12c69e63845b6d8bf1d3453edb0549ff9...v1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Update action.yml [\#2](https://github.com/tj-actions/changed-files/pull/2) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
|
||||
|
||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
||||
53
HISTORY.md
53
HISTORY.md
@@ -1,5 +1,53 @@
|
||||
# Changelog
|
||||
|
||||
## [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)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature request [\#15](https://github.com/tj-actions/changed-files/issues/15)
|
||||
- Added support for push events [\#21](https://github.com/tj-actions/changed-files/pull/21) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v3.3 [\#19](https://github.com/tj-actions/changed-files/pull/19) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v3.3](https://github.com/tj-actions/changed-files/tree/v3.3) (2021-04-20)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.2...v3.3)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Update action.yml [\#18](https://github.com/tj-actions/changed-files/pull/18) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v3.2 [\#17](https://github.com/tj-actions/changed-files/pull/17) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v3.2](https://github.com/tj-actions/changed-files/tree/v3.2) (2021-04-11)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.1...v3.2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Add support for all modified files [\#16](https://github.com/tj-actions/changed-files/pull/16) ([jackton1](https://github.com/jackton1))
|
||||
- Update test.yml [\#14](https://github.com/tj-actions/changed-files/pull/14) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v3.1 [\#13](https://github.com/tj-actions/changed-files/pull/13) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v3.1](https://github.com/tj-actions/changed-files/tree/v3.1) (2021-04-04)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3...v3.1)
|
||||
@@ -19,15 +67,12 @@
|
||||
- Configure Renovate [\#9](https://github.com/tj-actions/changed-files/pull/9) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update test.yml [\#8](https://github.com/tj-actions/changed-files/pull/8) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v2.1 [\#6](https://github.com/tj-actions/changed-files/pull/6) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v2.1](https://github.com/tj-actions/changed-files/tree/v2.1) (2021-03-18)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2...v2.1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v2](https://github.com/tj-actions/changed-files/tree/v2) (2021-03-14)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1...v2)
|
||||
|
||||
114
README.md
114
README.md
@@ -1,25 +1,64 @@
|
||||
[](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml)
|
||||
[](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml) <a href="https://github.com/search?q=tj-actions+changed-files+path%3A.github%2Fworkflows+language%3AYAML&type=code" target="_blank" title="Public workflows that use this action."><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-git-master.endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fchanged-files%26badge%3Dtrue" alt="Public workflows that use this action."></a>
|
||||
|
||||
changed-files
|
||||
-------------
|
||||
|
||||
Get modified files using [`git diff --diff-filter`](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203) to locate all files that have been modified relative to the default branch.
|
||||
Get all modified files relative to the default branch or preceding commit.
|
||||
|
||||
> NOTE: :warning: This action should only run on the following events :warning:
|
||||
> * [pull_request](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request)
|
||||
> * [pull_request_review](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_review)
|
||||
> * [pull_request_review_comment](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_review_comment)
|
||||
> * [pull_request_target](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target)
|
||||
|
||||
## 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).* |
|
||||
| has_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
|
||||
|
||||
With defaults
|
||||
> 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
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -30,9 +69,18 @@ jobs:
|
||||
name: Test changed-files
|
||||
steps:
|
||||
- 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@v3.1
|
||||
uses: tj-actions/changed-files@v4.2
|
||||
|
||||
- name: List all modified files
|
||||
run: |
|
||||
for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do
|
||||
echo "$file was modified"
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
@@ -44,26 +92,26 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Get changed files using defaults
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v3.1
|
||||
uses: tj-actions/changed-files@v4.2
|
||||
|
||||
- name: Get changed files using a comma separator
|
||||
id: changed-files-comma
|
||||
uses: tj-actions/changed-files@v3.1
|
||||
uses: tj-actions/changed-files@v4.2
|
||||
with:
|
||||
separator: ","
|
||||
|
||||
- name: List all added files
|
||||
run: |
|
||||
for file in "${{ steps.changed-files.outputs.added_files }}"; do
|
||||
echo $file
|
||||
echo "$file was added"
|
||||
done
|
||||
|
||||
- name: Run step when a file changes in a PR relative to the default branch
|
||||
- name: Run step when a file changes
|
||||
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
|
||||
- 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."
|
||||
@@ -71,32 +119,28 @@ jobs:
|
||||
|
||||
```
|
||||
|
||||
### Running [pre-commit](https://pre-commit.com/) on all modified files
|
||||
|
||||
## Inputs
|
||||
```yaml
|
||||
...
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
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.2
|
||||
|
||||
| Input | type | required | default | description |
|
||||
|:-------------:|:-----------:|:-------------:|:----------------------------:|:-------------:|
|
||||
| separator | `string` | `true` | `' '` | Separator to return outputs |
|
||||
- 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 }}
|
||||
token: ${{ secrets.github_token }}
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
|
||||
164
action.yml
164
action.yml
@@ -6,82 +6,152 @@ 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:
|
||||
description: List of added files.
|
||||
value: ${{ steps.changed-files.outputs.added_files }}
|
||||
value: ${{ steps.changed_files.outputs.added_files }}
|
||||
copied_files:
|
||||
description: List of copied files.
|
||||
value: ${{ steps.changed-files.outputs.copied_files }}
|
||||
value: ${{ steps.changed_files.outputs.copied_files }}
|
||||
deleted_files:
|
||||
description: List of deleted files.
|
||||
value: ${{ steps.changed-files.outputs.deleted_files }}
|
||||
value: ${{ steps.changed_files.outputs.deleted_files }}
|
||||
modified_files:
|
||||
description: List of modified files.
|
||||
value: ${{ steps.changed-files.outputs.modified_files }}
|
||||
value: ${{ steps.changed_files.outputs.modified_files }}
|
||||
renamed_files:
|
||||
description: List of renamed files.
|
||||
value: ${{ steps.changed-files.outputs.renamed_files }}
|
||||
value: ${{ steps.changed_files.outputs.renamed_files }}
|
||||
changed_files:
|
||||
description: List of changed files.
|
||||
value: ${{ steps.changed-files.outputs.changed_files }}
|
||||
value: ${{ steps.changed_files.outputs.changed_files }}
|
||||
unmerged_files:
|
||||
description: List of unmerged files.
|
||||
value: ${{ steps.changed-files.outputs.unmerged_files }}
|
||||
value: ${{ steps.changed_files.outputs.unmerged_files }}
|
||||
unknown_files:
|
||||
description: List of unknown files.
|
||||
value: ${{ steps.changed-files.outputs.unknown_files }}
|
||||
value: ${{ steps.changed_files.outputs.unknown_files }}
|
||||
all_changed_files:
|
||||
description: List of all changed files.
|
||||
value: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
value: ${{ steps.changed_files.outputs.all_changed_files }}
|
||||
all_modified_files:
|
||||
description: List of all changed modified and added files
|
||||
value: ${{ steps.changed-files.outputs.all_modified_files }}
|
||||
description: List of all copied modified and added files
|
||||
value: ${{ steps.changed_files.outputs.all_modified_files }}
|
||||
has_changed:
|
||||
description: Return true only when all files provided using the files input have all changed.
|
||||
value: ${{ steps.changed_files.outputs.has_changed }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- id: changed-files
|
||||
- id: changed_files
|
||||
run: |
|
||||
if [[ -z $GITHUB_BASE_REF ]]; then
|
||||
echo "Skipping: This should only run on pull_request.";
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
TARGET_BRANCH=${GITHUB_BASE_REF}
|
||||
CURRENT_BRANCH=${GITHUB_HEAD_REF}
|
||||
|
||||
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
||||
|
||||
echo "Getting head sha..."
|
||||
|
||||
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true)
|
||||
|
||||
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 }})$//')
|
||||
|
||||
echo "Getting diff..."
|
||||
echo "::set-output name=added_files::$ADDED"
|
||||
echo "::set-output name=copied_files::$COPIED"
|
||||
echo "::set-output name=deleted_files::$DELETED"
|
||||
echo "::set-output name=modified_files::$MODIFIED"
|
||||
echo "::set-output name=renamed_files::$RENAMED"
|
||||
echo "::set-output name=changed_files::$CHANGED"
|
||||
echo "::set-output name=unmerged_files::$UNMERGED"
|
||||
echo "::set-output name=unknown_files::$UNKNOWN"
|
||||
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
||||
if [[ -z $GITHUB_BASE_REF ]]; then
|
||||
HEAD_SHA=$(git rev-parse HEAD^1 || true)
|
||||
else
|
||||
TARGET_BRANCH=${GITHUB_BASE_REF}
|
||||
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
||||
HEAD_SHA=$(git rev-parse ${TARGET_BRANCH} || true)
|
||||
fi
|
||||
|
||||
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 }})$//')
|
||||
|
||||
echo "::set-output name=added_files::$ADDED"
|
||||
echo "::set-output name=copied_files::$COPIED"
|
||||
echo "::set-output name=deleted_files::$DELETED"
|
||||
echo "::set-output name=modified_files::$MODIFIED"
|
||||
echo "::set-output name=renamed_files::$RENAMED"
|
||||
echo "::set-output name=changed_files::$CHANGED"
|
||||
echo "::set-output name=unmerged_files::$UNMERGED"
|
||||
echo "::set-output name=unknown_files::$UNKNOWN"
|
||||
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
||||
|
||||
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=$'\n' SORTED_INPUT_FILES=($(sort <<<"${ALL_INPUT_FILES[*]}"))
|
||||
IFS=$'\n' SORTED_OUTPUT_ALL_MODIFIED_FILES=($(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}"))
|
||||
|
||||
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then
|
||||
echo "::set-output name=has_changed::true"
|
||||
else
|
||||
echo "::set-output name=has_changed::false"
|
||||
fi
|
||||
|
||||
echo "::set-output name=added_files::$ADDED"
|
||||
echo "::set-output name=copied_files::$COPIED"
|
||||
echo "::set-output name=deleted_files::$DELETED"
|
||||
echo "::set-output name=modified_files::$MODIFIED"
|
||||
echo "::set-output name=renamed_files::$RENAMED"
|
||||
echo "::set-output name=changed_files::$CHANGED"
|
||||
echo "::set-output name=unmerged_files::$UNMERGED"
|
||||
echo "::set-output name=unknown_files::$UNKNOWN"
|
||||
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
branding:
|
||||
icon: git-pull-request
|
||||
icon: file-text
|
||||
color: white
|
||||
|
||||
@@ -1,5 +1,44 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"enabled": true,
|
||||
"prHourlyLimit": 10,
|
||||
"prConcurrentLimit": 5,
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"dependencies"
|
||||
],
|
||||
"assignees": [
|
||||
"jackton1"
|
||||
],
|
||||
"assignAutomerge": true,
|
||||
"dependencyDashboard": true,
|
||||
"dependencyDashboardAutoclose": true,
|
||||
"lockFileMaintenance": {
|
||||
"enabled": true,
|
||||
"automerge": true
|
||||
},
|
||||
"packageRules": [
|
||||
{
|
||||
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest"],
|
||||
"automerge": true,
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"automerge"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "docker images",
|
||||
"matchLanguages": [
|
||||
"docker"
|
||||
],
|
||||
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest"],
|
||||
"rebaseWhen": "behind-base-branch",
|
||||
"addLabels": [
|
||||
"automerge"
|
||||
],
|
||||
"automerge": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user