Skip to content

Github Action to compare 2 files using diff ๐Ÿ•ต๏ธ

License

Notifications You must be signed in to change notification settings

GuillaumeFalourd/diff-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

59 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

diff-action

Diff Action Test (FILE Passed) Diff Action Test (FILE Failed)

Diff Action Test (LINE Passed) Diff Action Test (LINE Failed)

diff-action

Github Action to compare 2 files using diff ๐Ÿ•ต๏ธ


๐Ÿ–ฅ Supported OS

OS SUPPORTED
LINUX YES
MACOS YES
WINDOWS YES

๐Ÿ“š How to use this action?

The actions/checkout is mandatory to use this action, as it will need to access the repository files.

Field Mandatory Observation
first_file_path YES ex: path/to/file1.txt
second_file_path YES ex: path/to/file2.txt
expected_result NO PASSED (default) or FAILED
specific_line NO ex: 1 (integer value only)

Will return FAIL: If the diff output of the 2 files/lines is different than the expected_result input value.

Will return SUCCESS: If the diff output of the 2 files/lines is equal the expected_result input value.


๐Ÿ•ต๏ธ๐Ÿ“‹ Comparing 2 files

Expecting files to be identicals

    steps:
      - uses: actions/[email protected]
      - uses: GuillaumeFalourd/diff-action@v1
        with:
          first_file_path: path/to/file1.txt
          second_file_path: path/to/file2.txt
          expected_result: PASSED

Expecting files to be differents

    steps:
      - uses: actions/[email protected]
      - uses: GuillaumeFalourd/diff-action@v1
        with:
          first_file_path: path/to/file1.txt
          second_file_path: path/to/file2.txt
          expected_result: FAILED

๐Ÿ•ต๐Ÿ“ Comparing 2 lines

Expecting lines to be identicals

    steps:
      - uses: actions/[email protected]
      - uses: GuillaumeFalourd/diff-action@v1
        with:
          first_file_path: path/to/file1.txt
          second_file_path: path/to/file2.txt
          specific_line: 3
          expected_result: PASSED

Expecting lines to be differents

    steps:
      - uses: actions/[email protected]
      - uses: GuillaumeFalourd/diff-action@v1
        with:
          first_file_path: path/to/file1.txt
          second_file_path: path/to/file2.txt
          specific_line: 3
          expected_result: FAILED

โ˜‘๏ธ๐Ÿ”ด Workflow examples returning error

Diff Action Test (FILE Error) : Workflow with test returning ERROR (File) ๐Ÿ“‹

Diff Action Test (LINE Error) : Workflow with test returning ERROR (Line) ๐Ÿ“

Licensed

This repository uses the Apache License 2.0