Skip to content

Commit

Permalink
fix(action): Own workdirs if needed (#1405)
Browse files Browse the repository at this point in the history
Reviewed-by: Alexander Jung <[email protected]>
Approved-by: Alexander Jung <[email protected]>
  • Loading branch information
nderjung authored Mar 13, 2024
2 parents 1879c67 + d19ec6a commit 0945cee
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,18 @@ runs:
run: |
mkdir -p "${GITHUB_WORKSPACE}/.kraftkit"
# Always dump the contents of the inputs into relevant files, and simply
# remove if they do not contain any content.
touch "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
cat <<'EOF' >> "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
${{ inputs.before }}
EOF
if [ "$(cat ${GITHUB_WORKSPACE}/.kraftkit/before.sh)" != "" ]; then
cat <<'EOF' > "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
cat <<'EOF' > "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
#!/usr/bin/env bash
if [ "$(id -u)" != "1001" ] || [ "$(id -g)" != "127" ]; then
sudo chown -R runner:runner /home/runner
sudo chown -R runner:runner /github/workspace
fi
${{ inputs.before }}
EOF
chmod +x "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
else
rm -f "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
fi
chmod +x "${GITHUB_WORKSPACE}/.kraftkit/before.sh"
# Always dump the contents of the inputs into relevant files, and simply
# remove if they do not contain any content.
touch "${GITHUB_WORKSPACE}/.kraftkit/run.sh"
cat <<'EOF' >> "${GITHUB_WORKSPACE}/.kraftkit/run.sh"
${{ inputs.run }}
Expand Down

0 comments on commit 0945cee

Please sign in to comment.