Skip to content

Commit

Permalink
feat: Added support for using fork point to detect file changes. (#384)
Browse files Browse the repository at this point in the history
* feat: Added support for using fork point to detect file changes.

* Updated README.md

* Updated test.yml

* Updated action.yml

* Updated diff-sha.sh

* Updated diff-sha.sh

* Updated diff-sha.sh

* Updated diff-sha.sh

* Updated diff-sha.sh

* Updated README.md

* Updated test file

* Updated test.yml

* Updated test.yml

* Removed unused code.

* Removed unused code.

* Test using head_ref

* Test using head

* Removed unused code.
  • Loading branch information
jackton1 committed Feb 17, 2022
1 parent 9d43e5c commit 0b33274
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 63 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/test.yml
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: shellcheck
uses: reviewdog/action-shellcheck@v1.14

test-pull-requests-diff:
name: Test changed-files diff on pull_requests
test-pull-requests-from-forks:
name: Test changed-files diff on pull_requests from forks
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
Expand All @@ -40,6 +40,18 @@ jobs:
shell:
bash

- name: Get changed files use_fork_point
id: changed-files-fork-point
uses: ./
with:
use_fork_point: "true"

- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-fork-point.outputs) }}'
shell:
bash

- name: Get changed files
id: changed-files
uses: ./
Expand Down Expand Up @@ -446,28 +458,28 @@ jobs:
echo '${{ toJSON(steps.changed-files-specific-forward-slash.outputs) }}'
shell:
bash
- name: Verify any_changed files comma separator
- name: Verify any_changed files forward slash separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})"
exit 1
fi
shell:
bash
- name: Verify any_modified files comma separator
- name: Verify any_modified files forward slash separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_modified }}" != "false" ]]; then
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator
- name: Verify any_deleted files forward slash separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_deleted }}" != "false" ]]; then
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }})"
exit 1
fi
Expand Down

0 comments on commit 0b33274

Please sign in to comment.