Skip to content

Performs different types of assertions for use in an Action workflow. This is intended to be used to validate outputs and helpful in writing integration tests of Actions.

License

Notifications You must be signed in to change notification settings

nick-fields/assert-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

aa0067e · Feb 7, 2024

History

33 Commits
Feb 6, 2024
Sep 25, 2020
Oct 6, 2020
Nov 11, 2022
Feb 6, 2024
Sep 25, 2020
Sep 29, 2020
Nov 11, 2022
Mar 7, 2020
Feb 7, 2024
Feb 6, 2024
Oct 6, 2020
Sep 25, 2020
Dec 9, 2022
Dec 12, 2022

Repository files navigation

Assert Action

Various assertions to aide in validating action outputs

NOTE: Ownership of this project was transferred to my personal account nick-fields from my work account nick-invision. Details here


Inputs

expected

Required Expected value

actual

Required Actual value

comparison

Optional Type of comparison to perform. Supports exact (default), startsWith, endsWith, contains, notEqual, notStartsWith, notEndsWith, notContains


Outputs

result

Result of the comparison. Can be either passed or failed


Examples

Example usage w/ exact (using default comparison) assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: testing
    actual: ${{ steps.test-data.outputs.value }}

Example usage w/ exact assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: testing
    actual: ${{ steps.test-data.outputs.value }}
    comparison: exact

Example usage w/ startsWith assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: test
    actual: ${{ steps.test-data.outputs.value }}
    comparison: startsWith

Example usage w/ notStartsWith assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: abc
    actual: ${{ steps.test-data.outputs.value }}
    comparison: notStartsWith

Example usage w/ endsWith assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: ing
    actual: ${{ steps.test-data.outputs.value }}
    comparison: endsWith

Example usage w/ notEndsWith assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: abc
    actual: ${{ steps.test-data.outputs.value }}
    comparison: notEndsWith

Example usage w/ contains assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: est
    actual: ${{ steps.test-data.outputs.value }}
    comparison: contains

Example usage w/ notContains assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: abc
    actual: ${{ steps.test-data.outputs.value }}
    comparison: notContains

Example usage w/ notEqual assertion

- id: test-data
  run: echo "::set-output name=value::testing"
- uses: nick-fields/assert-action@v2
  with:
    expected: abc
    actual: ${{ steps.test-data.outputs.value }}
    comparison: notEqual

Limitations

  • If running on self-hosted runner, NodeJS must be installed.

Ownership

As of 2022/02/15 ownership of this project has been transferred to my personal account nick-fields from my work account nick-invision due to me leaving InVision. I am the author and have been the primary maintainer since day one and will continue to maintain this as needed.

No immediate action is required if you rely on this as GitHub handles ownership transfers pretty well. Any current workflow reference to nick-invision/assert-action@<whatever> will still work, but will just pull from nick-fields/assert-action@<whatever> instead. Who knows how long that will work, so at some point it would be beneficial to update your workflows to reflect the new owner accordingly.

About

Performs different types of assertions for use in an Action workflow. This is intended to be used to validate outputs and helpful in writing integration tests of Actions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published