Skip to content

Commit b1ac501

Browse files
authored
Merge pull request #2 from iwillig/add-more-local-tests
Add more debugger to the entrypoint.sh
2 parents c99c9ae + 970c267 commit b1ac501

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

entrypoint.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,27 @@ else
3737
if [ -n "$workspace_dir" ] && [ -d "$workspace_dir" ]; then
3838
echo "Checking for git repository in: $workspace_dir"
3939
cd "$workspace_dir"
40+
41+
# Handle potential git ownership/permissions issues in Docker
42+
if [ -d ".git" ]; then
43+
echo "Found .git directory, attempting to configure git for container access"
44+
# Tell git it's safe to access this repository
45+
git config --global --add safe.directory "$workspace_dir" || true
46+
# Set git config for the container user
47+
git config --global user.email "[email protected]" || true
48+
git config --global user.name "GitHub Action" || true
49+
fi
50+
4051
if git rev-parse --git-dir > /dev/null 2>&1; then
4152
git log -1 --pretty=%B > "$COMMIT_FILE"
4253
COMMIT_MESSAGE=$(cat "$COMMIT_FILE")
4354
echo "Checking last commit message: $COMMIT_MESSAGE"
4455
GIT_DIR_FOUND=true
4556
break
57+
else
58+
echo "Git command failed, checking permissions..."
59+
echo "Git directory permissions:"
60+
ls -la .git/ 2>/dev/null | head -5 || echo "Cannot read .git directory"
4661
fi
4762
fi
4863
done
@@ -72,7 +87,12 @@ echo "Running git-commit-linter with args: ${ARGS[@]}"
7287

7388
# Function to set GitHub Actions output (using new format)
7489
set_output() {
75-
echo "$1=$2" >> $GITHUB_OUTPUT
90+
if [ -n "$GITHUB_OUTPUT" ] && [ -w "$(dirname "$GITHUB_OUTPUT")" ]; then
91+
echo "$1=$2" >> "$GITHUB_OUTPUT"
92+
else
93+
echo "Warning: Cannot write to GITHUB_OUTPUT: $GITHUB_OUTPUT"
94+
echo "Output would be: $1=$2"
95+
fi
7696
}
7797

7898
# Set environment variables for the skip flags

0 commit comments

Comments
 (0)