Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,27 @@ else
if [ -n "$workspace_dir" ] && [ -d "$workspace_dir" ]; then
echo "Checking for git repository in: $workspace_dir"
cd "$workspace_dir"

# Handle potential git ownership/permissions issues in Docker
if [ -d ".git" ]; then
echo "Found .git directory, attempting to configure git for container access"
# Tell git it's safe to access this repository
git config --global --add safe.directory "$workspace_dir" || true
# Set git config for the container user
git config --global user.email "[email protected]" || true
git config --global user.name "GitHub Action" || true
fi

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
else
echo "Git command failed, checking permissions..."
echo "Git directory permissions:"
ls -la .git/ 2>/dev/null | head -5 || echo "Cannot read .git directory"
fi
fi
done
Expand Down Expand Up @@ -72,7 +87,12 @@ echo "Running git-commit-linter with args: ${ARGS[@]}"

# Function to set GitHub Actions output (using new format)
set_output() {
echo "$1=$2" >> $GITHUB_OUTPUT
if [ -n "$GITHUB_OUTPUT" ] && [ -w "$(dirname "$GITHUB_OUTPUT")" ]; then
echo "$1=$2" >> "$GITHUB_OUTPUT"
else
echo "Warning: Cannot write to GITHUB_OUTPUT: $GITHUB_OUTPUT"
echo "Output would be: $1=$2"
fi
}

# Set environment variables for the skip flags
Expand Down