diff --git a/README.md b/README.md index a08fe40a..2de88faf 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,7 @@ Get all modified files relative to the default branch (`pull_request*` events) o - Between the current pull request branch and the default branch - Between the last commit and the current pushed change. - Restrict change detection to a subset of files. - - Report on files that have all changed. - - Report on files that have at least one file change. + - Report on files that have at least one change. - Regex pattern matching on a subset of files. @@ -74,7 +73,6 @@ jobs: | Output | type | example | description | |:-------------------:|:------------:|:------------------------------:|:----------------------------------------:| -| all_changed | `string` | `true` OR `false` | Returns `true` only when the filenames provided using the `files` input have all changed | | any_changed | `string` | `true` OR `false` | Returns `true` when any of the filenames provided using the `files` input has changed | | all_modified_files | `string` | `'new.txt other.png ...'` | Select all modified files
*i.e a combination of all added,
copied and modified files (ACM).* | | all_changed_files | `string` | `'new.txt other.png ...'` | Select all paths (*)
*i.e a combination of all options below.* | @@ -143,11 +141,6 @@ jobs: .(sql)$ ^(mynewfile|custom) - - name: Run step if all files listed above have changed - if: steps.changed-files-specific.outputs.all_changed == 'true' - run: | - echo "All files listed above has changed." - - name: Run step if any of the listed files above change if: steps.changed-files-specific.outputs.any_changed == 'true' run: | @@ -179,9 +172,7 @@ jobs: ## Example - -![Screen Shot 2021-04-02 at 9 06 04 AM](https://user-images.githubusercontent.com/17484350/113418057-b9fff600-9392-11eb-84e5-f5a91bfa8b11.png) - +![Screen Shot 2021-05-13 at 4 55 30 PM](https://user-images.githubusercontent.com/17484350/118186772-1cc1c400-b40c-11eb-8fe8-b651e674ce96.png) * Free software: [MIT license](LICENSE) diff --git a/action.yml b/action.yml index 79343eaa..3a2f6f1b 100644 --- a/action.yml +++ b/action.yml @@ -46,9 +46,6 @@ 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 }} @@ -149,25 +146,10 @@ runs: ALL_INPUT_FILES=$(echo "$INPUT_FILES" | tr "\n" " " | xargs) echo "Input files: ${ALL_INPUT_FILES[@]}" - echo "Output all modified files: ${OUTPUT_ALL_MODIFIED_FILES[@]}" + echo "Matching modified files: ${OUTPUT_ALL_MODIFIED_FILES[@]}" - SORTED_INPUT_FILES=() - SORTED_OUTPUT_ALL_MODIFIED_FILES=() - - IFS=" " read -r -a SORTED_INPUT_FILES <<< "$(sort <<<"${ALL_INPUT_FILES[*]}")" - IFS=" " read -r -a SORTED_OUTPUT_ALL_MODIFIED_FILES <<< "$(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}")" - - if [[ ${#SORTED_OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then + if [[ ${#OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then echo "::set-output name=any_changed::true" - - echo "Sorted input files: ${SORTED_INPUT_FILES[@]}" - echo "Sorted output all modified files: ${SORTED_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 else echo "::set-output name=any_changed::false" fi