Skip to content

Latest commit

 

History

History
160 lines (114 loc) · 7.57 KB

README.md

File metadata and controls

160 lines (114 loc) · 7.57 KB

Codacy Badge CI Update release version. Public workflows that use this action.

Ubuntu Mac OS Windows

All Contributors

verify-changed-files

Verify that certain files or directories did or did not change during the workflow execution.

NOTE: ⚠️

  • This action only detects files that have pending uncommited changes generated during the workflow execution, for running a specific step when a file changes in a pull request or based on a new commit

    See: https://github.com/tj-actions/changed-files

Features

  • Fast execution (0-2 seconds on average).
  • Easy to debug.
  • Scales to large repositories.
  • Supports all platforms (Linux, MacOS, Windows).
  • GitHub-hosted runners support
  • GitHub Enterprise Server support.
  • self-hosted runners support.
  • Boolean output for detecting uncommited changes.
  • List all files that changed during the workflow execution.
  • Restrict change detection to a subset of files:

Usage

...
    steps:
      - uses: actions/checkout@v2

      - name: Change text file
        run: |
          echo "Modified" > new.txt

      - name: Change file in directory
        run: |
          echo "Changed" > test_directory/new.txt

      - name: Verify Changed files
        uses: tj-actions/verify-changed-files@v12
        id: verify-changed-files
        with:
          files: |
             *.txt
             test_directory
             action.yml
             **/*.py
             **/*.jpeg
             !*.sql

      - name: Run step only when files change.
        if: steps.verify-changed-files.outputs.files_changed == 'true'
        run: |
          echo "Changed files: ${{ steps.verify-changed-files.outputs.changed_files }}"
        # Outputs: "Changed files: new.txt test_directory/new.txt"

Using the contains function.

...
      - name: Verify Changed files
        uses: tj-actions/verify-changed-files@v12
        id: verify-changed-files
        with:
          files: |
             new.txt
             test_directory

      - name: Perform action when test_directory changes
        if: contains(steps.verify-changed-files.outputs.changed_files, 'test_directory')
        run: |
          echo "test_directory has changed."

If you feel generous and want to show some extra appreciation:

Support this project with a ⭐

Buy me a coffee

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
autocrlf string true "input" Modify the git config core.autocrlf.
files string true File/Directory names to check for
uncommited changes.
separator string true " " Output string separator.

Outputs

OUTPUT TYPE DESCRIPTION
changed_files string List of changed files
files_changed string Boolean indicating that files have
changed.

Report Bugs

Report bugs at https://github.com/tj-actions/verify-changed-files/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your workflow that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Max Kahnt

📖

William Killerud

💻

This project follows the all-contributors specification. Contributions of any kind welcome!