Skip to content

Commit c0ae124

Browse files
timothytimothyclarke
timothy
authored andcommitted
Adding git-sub-dir
Signed-off-by: Timothy Clarke <[email protected]>
1 parent 72ed18e commit c0ae124

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ inputs:
7474
description: If true it will sign-off commit
7575
required: false
7676
default: "false"
77+
git-sub-dir:
78+
description: Subdirectory that terraform code is checked out into
79+
required: false
80+
default: ""
7781
fail-on-diff:
7882
description: Fail the job if there is any diff found between the generated output and existing file (ignored if `git-push` is set)
7983
required: false
@@ -85,7 +89,7 @@ outputs:
8589

8690
runs:
8791
using: docker
88-
image: "docker://quay.io/terraform-docs/gh-actions:1.2.0"
92+
image: "docker://quay.io/terraform-docs/gh-actions:1.2.1"
8993
env:
9094
INPUT_WORKING_DIR: ${{ inputs.working-dir }}
9195
INPUT_ATLANTIS_FILE: ${{ inputs.atlantis-file }}
@@ -105,6 +109,7 @@ runs:
105109
INPUT_GIT_PUSH_SIGN_OFF: ${{ inputs.git-push-sign-off }}
106110
INPUT_GIT_PUSH_USER_NAME: ${{ inputs.git-push-user-name }}
107111
INPUT_GIT_PUSH_USER_EMAIL: ${{ inputs.git-push-user-email }}
112+
INPUT_GIT_SUB_DIR: ${{ inputs.git-sub-dir }}
108113

109114
branding:
110115
icon: file-text

src/docker-entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ if [ -z "${INPUT_GIT_PUSH_USER_EMAIL}" ]; then
4848
INPUT_GIT_PUSH_USER_EMAIL="github-actions[bot]@users.noreply.github.com"
4949
fi
5050

51+
if [ -n "${INPUT_GIT_SUB_DIR}" ]; then
52+
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}/${INPUT_GIT_SUB_DIR}"
53+
echo "Using non-standard GITHUB_WORKSPACE of ${GITHUB_WORKSPACE}"
54+
fi
55+
5156
git_setup() {
5257
# When the runner maps the $GITHUB_WORKSPACE mount, it is owned by the runner
5358
# user while the created folders are owned by the container user, causing this
5459
# error. Issue description here: https://github.com/actions/checkout/issues/766
55-
git config --global --add safe.directory /github/workspace
60+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
5661

5762
git config --global user.name "${INPUT_GIT_PUSH_USER_NAME}"
5863
git config --global user.email "${INPUT_GIT_PUSH_USER_EMAIL}"

0 commit comments

Comments
 (0)