Skip to content

Commit cedd575

Browse files
authored
Merge pull request #10 from crytic/dev-compat-symlink
Create symlink from host-path to container-path to enhance compatibility
2 parents 848658e + 2d60757 commit cedd575

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ inputs:
2121
description: 'Whether to ignore the compilation step when running crytic-compile and Slither.'
2222
default: false
2323
type: boolean
24+
internal-github-workspace:
25+
# Do not set manually. This is a hacky way to pass the host workspace path to inside the action
26+
# This is used to improve compatibility when using `ignore-compile`.
27+
# GitHub rewrites the argument if it is passed directly, so we use toJSON to "transform"
28+
# it and avoid the remapping done by GitHub Actions.
29+
default: ${{ toJSON(github.workspace) }}
2430
outputs:
2531
sarif:
2632
description: 'If produced, the path of the SARIF file, relative to the repo root.'

entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ SLITHERARGS="$(get INPUT_SLITHER-ARGS)"
1515
SLITHERCONF="$(get INPUT_SLITHER-CONFIG)"
1616
IGNORECOMPILE="$(get INPUT_IGNORE-COMPILE)"
1717

18+
compatibility_link()
19+
{
20+
HOST_GITHUB_WORKSPACE="$(get INPUT_INTERNAL-GITHUB-WORKSPACE | tr -d \")"
21+
if [[ -d "$GITHUB_WORKSPACE" ]]; then
22+
mkdir -p "$(dirname "$HOST_GITHUB_WORKSPACE")"
23+
ln -s "$GITHUB_WORKSPACE" "$HOST_GITHUB_WORKSPACE"
24+
echo "[-] Applied compatibility link: $HOST_GITHUB_WORKSPACE -> $GITHUB_WORKSPACE"
25+
fi
26+
}
27+
1828
install_solc()
1929
{
2030
if [[ -z "$SOLCVER" ]]; then
@@ -153,6 +163,7 @@ if [[ -z "$IGNORECOMPILE" || $IGNORECOMPILE =~ ^[Ff]alse$ ]]; then
153163
install_foundry
154164
install_deps
155165
else
166+
compatibility_link
156167
IGNORECOMPILEFLAG="--ignore-compile"
157168
fi
158169

0 commit comments

Comments
 (0)