GitHub - tj-actions/verify-changed-files: :octocat: Github action to verify file changes that occur during the workflow execution. (original) (raw)

Ubuntu Mac OS Windows Public workflows that use this action.

Codacy Badge CI Update release version.

All Contributors

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

Note

Features

Usage

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

  - 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@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20
    id: verify-changed-files
    with:
      files: |
         *.txt
         test_directory
         action.yml
         **/*.{jpeg,py}
         !*.sql

  - name: Run step only when any of the above files change.
    if: steps.verify-changed-files.outputs.files_changed == 'true'
    env:
      CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
    run: |
      echo "Changed files: $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@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20 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."

Get all unstaged (tracked/untracked) files

... - name: Verify Changed files uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20 id: verify-changed-files

  - name: List all changed tracked and untracked files
    env:
      CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
    run: |
      echo "Changed files: $CHANGED_FILES"

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

Support this project with a ⭐

Buy me a coffee

Inputs

Outputs

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

Known Limitation

Warning

Report Bugs

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

If you are reporting a bug, please include:

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Max Kahnt Max Kahnt📖 William Killerud William Killerud💻 Minecraftschurli Minecraftschurli💻 📖 ⚠️ Stefan Hoth Stefan Hoth💻 Raphael Boidol Raphael Boidol📖 Lars Lars💻 ⚠️ 📖

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