Skip to content

Commit

Permalink
fix: execute git safe.directory at run time
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Sep 6, 2022
1 parent f5c56b3 commit 630d581
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
GITHUB_WORKSPACE=/github/workspace
GITHUB_EVENT_PATH=/github/workspace/action/test/fixtures/payload.json
GITHUB_EVENT_NAME=push
INPUT_CONFIG=/github/workspace/.semantic.json
Expand Down
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ FROM alpine:3.16 AS base
# hadolint ignore=DL3018
RUN apk add --no-cache --update nodejs npm git openssh ca-certificates ruby-bundler

# alpine has trust issues
RUN git config --global --add safe.directory '*'

WORKDIR /action

ENTRYPOINT [ "node" ]
ENTRYPOINT [ "/action/entrypoint.sh" ]

# --- build stage --- #

Expand All @@ -37,5 +34,3 @@ COPY --from=build /action/node_modules ./node_modules

# copy files
COPY action ./

CMD ["--no-warnings=ExperimentalWarnings", "/action/index.js"]
7 changes: 7 additions & 0 deletions action/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# this must be executed at run time, because github action runner changes $HOME value to /github/home
git config --global --add safe.directory "${GITHUB_WORKSPACE:=.}"

# normal execution
node --no-warnings=ExperimentalWarnings /action/index.js

0 comments on commit 630d581

Please sign in to comment.