Compare commits

...

41 Commits
v3.1 ... v4.1

Author SHA1 Message Date
Tonye Jack
e8ace0110c Update action.yml 2021-04-23 06:43:57 -04:00
Tonye Jack
e83c52fc11 Update README.md 2021-04-23 06:40:30 -04:00
Tonye Jack
853caa603d Delete CHANGELOG.md 2021-04-23 06:28:30 -04:00
Tonye Jack
17e2510d74 Update README.md 2021-04-23 06:25:35 -04:00
Tonye Jack
e858c485a2 Merge pull request #22 from tj-actions/upgrade-to-v4
Upgraded to v4
2021-04-23 06:24:47 -04:00
jackton1
19483649c5 Upgraded from v3.3 -> v4 2021-04-23 10:24:08 +00:00
Tonye Jack
c061ef1fa3 Update README.md 2021-04-23 06:22:08 -04:00
Tonye Jack
84fd7c7a42 Update README.md 2021-04-23 06:20:40 -04:00
Tonye Jack
af5a2e5d10 Update README.md 2021-04-23 06:20:04 -04:00
Tonye Jack
e8f8d088f6 Update README.md 2021-04-23 06:19:52 -04:00
Tonye Jack
c23398e584 Update test.yml 2021-04-23 06:17:20 -04:00
Tonye Jack
9352b30cc3 Update README.md 2021-04-23 06:15:57 -04:00
Tonye Jack
7b1f7ad57b Merge pull request #21 from tj-actions/add-support-for-push-events 2021-04-23 06:14:55 -04:00
Tonye Jack
e368753cac Update test.yml 2021-04-23 06:14:21 -04:00
Tonye Jack
b47ed0ffe6 Update action.yml 2021-04-23 06:13:11 -04:00
Tonye Jack
0e1d04f780 Added support for push events 2021-04-23 06:04:38 -04:00
Tonye Jack
814a7ea227 Update README.md 2021-04-22 09:03:03 -04:00
Tonye Jack
4420c3c441 Update README.md 2021-04-22 03:09:02 -04:00
Tonye Jack
feadcbc861 Merge pull request #19 from tj-actions/upgrade-to-v3.3
Upgraded to v3.3
2021-04-20 21:17:01 -04:00
jackton1
b60f5e56b6 Upgraded from v3.2 -> v3.3 2021-04-20 23:43:55 +00:00
Tonye Jack
489e2d514f Merge pull request #18 from tj-actions/remove-unused-line
Update action.yml
2021-04-20 19:42:32 -04:00
Tonye Jack
d889202b3a Update action.yml 2021-04-20 19:41:57 -04:00
Tonye Jack
9ec430d951 Updated renovate.json 2021-04-15 23:20:28 -04:00
Tonye Jack
ca2815e08c Update README.md 2021-04-11 18:27:34 -04:00
Tonye Jack
120ceacaf7 Update README.md 2021-04-11 18:07:31 -04:00
Tonye Jack
d205273c8b Update action.yml 2021-04-11 18:06:58 -04:00
Tonye Jack
cc55e77a98 Merge pull request #17 from tj-actions/upgrade-to-v3.2
Upgraded to v3.2
2021-04-11 18:02:51 -04:00
Tonye Jack
64fdc4478a Update README.md 2021-04-11 18:02:39 -04:00
jackton1
669bce6c25 Upgraded from v3.1 -> v3.2 2021-04-11 22:00:42 +00:00
Tonye Jack
8d5a33c603 Merge pull request #16 from tj-actions/feature/add-support-for-all-modified-files
Add support for all modified files
2021-04-11 17:59:11 -04:00
Tonye Jack
00d83b13d6 Update README.md 2021-04-11 17:57:15 -04:00
Tonye Jack
223d074d69 Add support for all modified files 2021-04-11 17:54:10 -04:00
Tonye Jack
d31b4186e9 Deleted .github/ISSUE_TEMPLATE.md 2021-04-09 08:28:43 -04:00
Tonye Jack
223ef07a3f Added .github/ISSUE_TEMPLATE/feature_request.md 2021-04-09 05:07:07 -04:00
Tonye Jack
5eeb83fa4e Added .github/ISSUE_TEMPLATE/bug_report.md 2021-04-09 05:06:00 -04:00
Tonye Jack
83e0ed24b0 Updated .github/workflows/sync-release-version.yml 2021-04-04 10:50:20 -04:00
Tonye Jack
737590d30e Update README.md 2021-04-04 09:11:55 -04:00
Tonye Jack
4c551d94e0 Merge pull request #14 from tj-actions/changed-triggered-events-test-action
Update test.yml
2021-04-04 09:08:38 -04:00
Tonye Jack
506d6c005e Update test.yml 2021-04-04 09:08:26 -04:00
Tonye Jack
fa5d79bbb3 Merge pull request #13 from tj-actions/upgrade-to-v3.1
Upgraded to v3.1
2021-04-04 09:06:07 -04:00
jackton1
c9e3c674ba Upgraded from v3 -> v3.1 2021-04-04 13:01:55 +00:00
9 changed files with 239 additions and 54 deletions

View File

@@ -1,10 +0,0 @@
* changed-files:
### Description
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
### What I Did
Add some details about your workflow ?

32
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -9,6 +9,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Sync release version.
uses: tj-actions/sync-release-version@v8
id: sync-release-version

View File

@@ -15,16 +15,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run changed-files with defaults
if: github.event_name == 'pull_request'
id: changed-files
uses: ./
- name: Show output
if: github.event_name == 'pull_request'
run: |
echo "${{ toJSON(steps.changed-files.outputs) }}"
- name: List all modified files
if: github.event_name == 'pull_request'
run: |
for file in "${{ steps.changed-files.outputs.modified_files }}"; do
echo $file
@@ -34,12 +33,10 @@ jobs:
run: |
echo "Your README.md has been modified ${{ steps.changed-files.outputs.modified_files }}."
- name: Run changed-files with comma separator
if: github.event_name == 'pull_request'
id: changed-files-comma
uses: ./
with:
separator: ","
- name: Show output
if: github.event_name == 'pull_request'
run: |
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"

View File

@@ -1,5 +1,45 @@
# Changelog
## [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)
**Merged pull requests:**
- Upgraded to v3 [\#12](https://github.com/tj-actions/changed-files/pull/12) ([jackton1](https://github.com/jackton1))
## [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)

View File

@@ -1,52 +1,114 @@
[![CI](https://github.com/tj-actions/changed-files/actions/workflows/test.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [![Update release version.](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml)
[![CI](https://github.com/tj-actions/changed-files/actions/workflows/test.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [![Update release version.](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml/badge.svg)](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.
> 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)
Get all modified files relative to the default branch or preceding commit.
## Usage
### Push event
```yaml
name: CI
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
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@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
```
## Example
```yaml
...
steps:
- uses: actions/checkout@v2
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v3
id: changed_files
uses: tj-actions/changed-files@v4
- name: Get changed files using a comma separator
id: changed-files-comma
uses: tj-actions/changed-files@v3
id: changed_files_comma
uses: tj-actions/changed-files@v4
with:
separator: ","
- name: List all added files
run: |
for file in "${{ steps.changed-files.outputs.added_files }}"; do
for file in "${{ steps.changed_files.outputs.added_files }}"; do
echo $file
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')
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')
if: contains(steps.changed_files.outputs.deleted_files, 'test.txt')
run: |
echo "Your test.txt has been deleted."
```
### Running [pre-commit](https://pre-commit.com/) on all modified files
```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
- 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 }}
```
## Inputs
@@ -71,6 +133,7 @@ Using the default separator.
| 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

View File

@@ -10,51 +10,51 @@ inputs:
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 copied modified and added files
value: ${{ steps.changed_files.outputs.all_modified_files }}
runs:
using: 'composite'
steps:
- id: changed-files
- id: changed_files
run: |
echo "Getting head sha..."
if [[ -z $GITHUB_BASE_REF ]]; then
echo "Skipping: This should only run on pull_request.";
exit 0;
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
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)
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 }})$//')
@@ -64,8 +64,9 @@ runs:
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"
@@ -75,8 +76,9 @@ runs:
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"
shell: bash
branding:
icon: git-pull-request
icon: list
color: white

View File

@@ -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": ["minor", "patch", "pin", "digest"],
"automerge": true,
"rebaseWhen": "behind-base-branch",
"addLabels": [
"automerge"
]
},
{
"description": "docker images",
"matchLanguages": [
"docker"
],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"rebaseWhen": "behind-base-branch",
"addLabels": [
"automerge"
],
"automerge": true
}
]
}
}