diff --git a/.actrc b/.actrc new file mode 100644 index 0000000..69c5811 --- /dev/null +++ b/.actrc @@ -0,0 +1,3 @@ +# Act configuration file +# Use smaller runners for faster testing +-P ubuntu-latest=catthehacker/ubuntu:act-latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2388cdb..958be7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM babashka/babashka:1.3.191-alpine -# Install git (needed for git log command in entrypoint) -RUN apk add --no-cache git +# Install git, bash, and openjdk (needed for babashka dependencies) +RUN apk add --no-cache git bash openjdk21-jre # Set working directory WORKDIR /action diff --git a/entrypoint.sh b/entrypoint.sh index 595b792..878bd3e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -25,9 +25,36 @@ if [ -n "$COMMIT_MESSAGE" ]; then echo "Checking provided commit message: $COMMIT_MESSAGE" else # Get the last commit message if none provided - git log -1 --pretty=%B > "$COMMIT_FILE" - COMMIT_MESSAGE=$(cat "$COMMIT_FILE") - echo "Checking last commit message: $COMMIT_MESSAGE" + # Try different possible workspace locations for GitHub Actions + WORKSPACE_DIRS=( + "/github/workspace" + "$GITHUB_WORKSPACE" + "$(pwd)" + ) + + GIT_DIR_FOUND=false + for workspace_dir in "${WORKSPACE_DIRS[@]}"; do + if [ -n "$workspace_dir" ] && [ -d "$workspace_dir" ]; then + echo "Checking for git repository in: $workspace_dir" + cd "$workspace_dir" + if git rev-parse --git-dir > /dev/null 2>&1; then + git log -1 --pretty=%B > "$COMMIT_FILE" + COMMIT_MESSAGE=$(cat "$COMMIT_FILE") + echo "Checking last commit message: $COMMIT_MESSAGE" + GIT_DIR_FOUND=true + break + fi + fi + done + + if [ "$GIT_DIR_FOUND" = false ]; then + echo "Error: No git repository found and no commit message provided" + echo "Tried directories: ${WORKSPACE_DIRS[*]}" + echo "Current working directory: $(pwd)" + echo "Directory listing:" + ls -la + exit 1 + fi fi # Prepare arguments @@ -129,4 +156,4 @@ if [ "$FAIL_ON_ERROR" = "false" ]; then exit 0 else exit $EXIT_CODE -fi \ No newline at end of file +fi