Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/docker/alpine-3.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 authored Feb 12, 2021
2 parents e34c91d + 51e5e2c commit 5fa278c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ jobs:
uses: reviewdog/action-shellcheck@v1
- name: Test sql file has no changes
uses: ./
id: changed_files_non_expected
id: changed_files_not_expected
with:
files: |
test/new.txt
test/new.sql
test/new/.(sql|txt)
- name: Display changed files
if: steps.changed_files_not_expected.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_files_not_expected.outputs.changed_files }}"
- name: Verify Changes
if: steps.changed_files_non_expected.outputs.files_changed == 'true'
if: steps.changed_files_not_expected.outputs.files_changed == 'true'
run: |
echo "Changes found: (Not expected)"
exit 1
Expand All @@ -42,6 +46,10 @@ jobs:
test/new.txt
test/new.sql
test/new/.(sql|txt)
- name: Display changed files
if: steps.changed_files_expected.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_files_expected.outputs.changed_files }}"
- name: Verify Changes to test/new.txt
if: steps.changed_files_expected.outputs.files_changed != 'true'
run: |
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Update release version.](https://github.com/tj-actions/verify-changed-files/workflows/Update%20release%20version./badge.svg)](https://github.com/tj-actions/verify-changed-files/actions?query=workflow%3A%22Update+release+version.%22)

# verify-changed-files
A github action to verify that certian files changed during the workflow execution.
A github action to verify that certian files did or didn't change during the workflow execution.

```yaml
on:
Expand Down Expand Up @@ -31,6 +31,10 @@ jobs:
.(py|jpeg)$
.(sql)$
^(mynewfile|custom)
- name: Display changed files
if: steps.changed_files.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_files.outputs.changed_files }}" # Outputs: test_directory/new.txt
- name: Perform action when files change.
if: steps.changed_files.outputs.files_changed == 'true'
run: |
Expand All @@ -45,3 +49,11 @@ jobs:
|:-------------:|:-----------:|:--------------:|:-----------------------------:|:--------------------------:|
| token | `string` | `true` | `${{ github.token }}` <br/> | github action default token or PAT token |
| files | `array` | `true` | | List of file(s)/directory names <br/> (regex optional) to check for changes <br/> during workflow execution |


## Outputs

| Input | type | example | description |
|:-------------:|:-----------:|:-------------:|:--------------------------:|
| files_changed | `boolean` | `true` | Indicates that there are outstanding changes |
| changed_files | `array` | `[example.txt, ...]` | List of file(s)/directory names <br/> that changed <br/> during the workflow execution |
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if [[ -z ${CHANGED_FILES} ]]; then
echo "::set-output name=files_changed::false"
else
echo "::set-output name=files_changed::true"
echo "::set-output name=changed_files::${CHANGED_FILES}"
fi

exit 0;

0 comments on commit 5fa278c

Please sign in to comment.