Skip to content

Latest commit

 

History

History
53 lines (40 loc) · 1.59 KB

README.md

File metadata and controls

53 lines (40 loc) · 1.59 KB

Check diff Action

This action check if a file or directory has differences.

Usage

If you want to check if some file has a difference, define a job like the following.

Note that multiple revisions must be fetch with actions/checkout's fetch-deps.

jobs:
  file-watch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: hyorimitsu/[email protected]
        id: diff
        name: diff
        with:
          target-branch: main
          target-file: test/file1.json
      - name: difference check
        if: steps.diff.outputs.file-diff > 0
        run: |
          echo 'test/file1.json is changed'

See here for other examples.

Input / Output parameters

The input parameters are as follows.

key required description
target-branch true The branch that triggers this action.
target-file false The path to the file where you want to check for differences.
target-dir false The path to the directory where you want to check for differences.

The output parameters are as follows.

key description
file-diff If over 0, there is a difference in the target-file.
dir-diff If over 0, there is a difference in the target-dir.

License

The scripts and documentation in this repository are released under the MIT License.