Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 73069d2

Browse files
authored
Merge pull request #26 from aiming/debug-option
checkout_dir 指定時にエラーになる現象の修正
2 parents 0857ffa + 4e65c75 commit 73069d2

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

action.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ inputs:
2626
description: 'Clone with fetching LFS .'
2727
default: false
2828
checkout_dir:
29-
description: 'expoterd NFS directory with host ip address. ex:10.0.0.1:/exports'
29+
description: 'Name of directory to check out'
3030
required: true
3131
depth:
3232
description: 'git clone --depth={} option'
@@ -40,6 +40,11 @@ runs:
4040
- shell: bash
4141
if: ${{ !env.ACT }}
4242
run: |
43+
if [ -n "$RUNNER_DEBUG" ] || [ -n "$ACTIONS_STEP_DEBUG" ]; then
44+
echo "Enable debug logging"
45+
set -x
46+
fi
47+
4348
echo $GITHUB_ACTION_PATH
4449
source $GITHUB_ACTION_PATH/try.sh
4550
@@ -64,15 +69,21 @@ runs:
6469
DEPTH=--depth=${{ inputs.depth }}
6570
fi
6671
72+
if [ ! -z "${{ inputs.reference_dir }}" ]; then
73+
REFERENCE_IF_ABLE="--reference-if-able=${{ inputs.reference_dir }}"
74+
fi
75+
6776
try_till_success \
6877
/usr/bin/git clone \
6978
$DEPTH \
70-
--reference-if-able=${{ inputs.reference_dir }} \
79+
$REFERENCE_IF_ABLE \
7180
https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git \
7281
${{ inputs.checkout_dir }}
7382
74-
if [ $(git config --global --get-all safe.directory | grep -c "$(pwd)$") -eq 0 ]; then
75-
/usr/bin/git config --global --add safe.directory $(pwd)
83+
CHECKOUT_FULL_PATH="$(pwd)${{ inputs.checkout_dir }})"
84+
CHECKOUT_FULL_PATH="$(realpath $CHECKOUT_FULL_PATH)"
85+
if [ $(git config --global --get-all safe.directory | grep -c "${CHECKOUT_FULL_PATH}$") -eq 0 ]; then
86+
/usr/bin/git config --global --add safe.directory "${CHECKOUT_FULL_PATH}"
7687
fi
7788
7889
pushd ${{ inputs.checkout_dir }}

0 commit comments

Comments
 (0)