Skip to content

Commit

Permalink
Merge pull request #7 from crytic/dev-echidna-workdir
Browse files Browse the repository at this point in the history
Add support for changing working directory
  • Loading branch information
elopez authored Mar 15, 2022
2 parents 27d976b + 536c342 commit d6ee373
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pages](https://github.com/crytic/echidna/wiki).
| `output-file` | Capture echidna-test's output into a file. The path must be relative to the repository root.
| `echidna-version` | Version of the Echidna Docker image to use.
| `negate-exit-status` | Apply logical NOT to echidna-test's exit status (for testing the action).
| `echidna-workdir` | Path to run echidna-test from. Note that `files` and `config` are relative to this path.

## Outputs

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ inputs:
description: "Version of the Echidna Docker image to use"
required: false
default: latest
echidna-workdir:
description: "Path to run echidna-test from. Note that `files` and `config` are relative to this path"
required: false

outputs:
output-file:
Expand Down Expand Up @@ -108,3 +111,4 @@ runs:
INPUT_SOLC-VERSION: ${{ inputs.solc-version }}
INPUT_OUTPUT-FILE: ${{ inputs.output-file }}
INPUT_NEGATE-EXIT-STATUS: ${{ inputs.negate-exit-status }}
INPUT_ECHIDNA-WORKDIR: ${{ inputs.echidna-workdir }}
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ if [[ -n "$OUTPUT_FILE" ]]; then
exec > >(tee "$OUTPUT_FILE")
fi

WORKDIR="$(get 'INPUT_ECHIDNA-WORKDIR')"
if [[ -n "$WORKDIR" ]]; then
cd "$WORKDIR"
fi

if [[ -n "$(get 'INPUT_NEGATE-EXIT-STATUS')" ]]; then
! "${CMD[@]}"
else
Expand Down

0 comments on commit d6ee373

Please sign in to comment.