diff --git a/README.md b/README.md index c8af53e..78c8b54 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ jobs: | `ignore-compile` | If set to true, the Slither action will not attempt to compile the project. False by default. See [Advanced compilation](#advanced-compilation). | `fail-on` | Cause the action to fail if Slither finds any issue of this severity or higher. See [action fail behavior](#action-fail-behavior). | `node-version` | The version of `node` to use. If this field is not set, the latest version will be used. +| `foundry-version`| The version of Foundry to use. If this field is not set, the latest nightly version will be used. | `sarif` | If provided, the path of the SARIF file to produce, relative to the repo root (see [Github Code Scanning integration](#github-code-scanning-integration)). | `slither-args` | Extra arguments to pass to Slither. | `slither-config` | The path to the Slither configuration file. By default, `./slither.config.json` is used if present. See [Configuration file](https://github.com/crytic/slither/wiki/Usage#configuration-file). diff --git a/action.yml b/action.yml index 75a2bb7..2622330 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,8 @@ inputs: description: 'The version of solc to use. Should be autodetected, but may be specified manually.' node-version: description: 'The version of node to use.' + foundry-version: + description: 'The version of Foundry to use.' target: description: 'The path of the project that Slither should analyze, relative to the repo root.' default: . diff --git a/entrypoint.sh b/entrypoint.sh index f3d6e65..ac3979f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,6 +24,7 @@ SLITHERCONF="$(get INPUT_SLITHER-CONFIG)" SLITHERPLUGINS="$(get INPUT_SLITHER-PLUGINS)" STDOUTFILE="/tmp/slither-stdout" IGNORECOMPILE="$(get INPUT_IGNORE-COMPILE)" +FOUNDRYVER="$(get INPUT_FOUNDRY-VERSION)" # #19 - an user may set SOLC_VERSION in the workflow and cause problems here. # Make sure it's unset. If you need to use a different solc version, override @@ -152,7 +153,12 @@ install_node() install_foundry() { if [[ -d "$TARGET" ]] && [[ -f "$TARGET/foundry.toml" ]]; then - echo "[-] Foundry target detected, installing foundry nightly" + if [[ -z "$FOUNDRYVER" ]]; then + FOUNDRYVER="nightly" + echo "[-] FOUNDRYVER was not set, using the nightly version." + fi + + echo "[-] Foundry target detected, installing foundry $FOUNDRYVER" wget -q -O foundryup https://raw.githubusercontent.com/foundry-rs/foundry/7b452656f722fc560f0414db3ce24a1f2972a8b7/foundryup/foundryup if [ ! "e7628766329e2873484d5d633c750b5019eec77ae506c11a0ef13b440cc3e7c2 foundryup" = "$(sha256sum foundryup)" ]; then @@ -163,7 +169,7 @@ install_foundry() export FOUNDRY_DIR="/opt/foundry" export PATH="$FOUNDRY_DIR/bin:$PATH" mkdir -p "$FOUNDRY_DIR/bin" "$FOUNDRY_DIR/share/man/man1" - bash foundryup + bash foundryup -- -v "$FOUNDRYVER" rm foundryup fi }