Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

Verify Changed files

Actions
Find files that were modified during workflow execution
v8.2
Star (170)

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

Ubuntu Mac OS Windows

All Contributors

verify-changed-files

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

Features

  • Boolean output indicating the presence of uncommited changes.
  • List all files that changed during the workflow execution.
  • Restrict change detection to a subset of files.

Usage

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 relative to the default branch or previous commit

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

  • Detects files that were Added, Copied, Modified, Unmerged, Unknown, had their Type changed, Unstaged and Renamed.

...
    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@v8.1
        id: verify-changed-files
        with:
          files: |
             new.txt
             test_directory
             .(py|jpeg)$
             \.sql$
             ^(mynewfile|custom)

      - 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@v8.1
        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."

Inputs

Input type required default description
token string true ${{ github.token }}
GITHUB_TOKEN
or a repo scoped
Personal Access Token
files string[] OR string true Check for uncommited changes
using only
these list of file(s)

Outputs

Input type example description
files_changed string true OR false Indicates that there are outstanding changes
changed_files string example.txt ... List of file(s)/directory names
that changed
during the workflow execution

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

Support me with a ⭐

Buy me a coffee

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Max Kahnt

📖

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

Verify Changed files is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Find files that were modified during workflow execution
v8.2

Verify Changed files is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.