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

Commit 47d839f

Browse files
committed
inputs.github_actorへurlencodeが必要な値があるとlfs pullできなくなる現象の対応
1 parent bb30903 commit 47d839f

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
@@ -37,6 +37,16 @@ inputs:
3737
runs:
3838
using: "composite"
3939
steps:
40+
- uses: actions/github-script@v7
41+
id: script
42+
with:
43+
result-encoding: string
44+
script: |
45+
const actor = encodeURI('${{ inputs.github_actor }}')
46+
const token = encodeURI('${{ inputs.github_token }}')
47+
core.setOutput('actor', actor)
48+
core.setOutput('token', token)
49+
4050
- shell: bash
4151
if: ${{ !env.ACT }}
4252
run: |
@@ -50,14 +60,17 @@ runs:
5060
5161
try_till_success curl -s 'https://github.com' > /dev/null
5262
63+
GITHUB_ACTOR='${{ steps.script.outputs.actor }}'
64+
GITHUB_TOKEN='${{ steps.script.outputs.token }}'
65+
5366
export __SHA=${{ inputs.sha || github.sha }}
5467
if [ ! -z "${{ inputs.branch_name }}" ]; then
5568
# Remove "refs/heads/" at head if exists it
5669
__BRANCH=${{ inputs.branch_name }}
5770
__BRANCH=${__BRANCH#refs/heads/}
5871
5972
# Override sha value if branch_name is presented.
60-
__SHA=$(try_till_success /usr/bin/git ls-remote https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git | grep -E "\srefs/heads/${__BRANCH}$" | cut -f 1 )
73+
__SHA=$(try_till_success /usr/bin/git ls-remote https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${{ inputs.github_repository }}.git | grep -E "\srefs/heads/${__BRANCH}$" | cut -f 1 )
6174
fi
6275
6376
if ! ${{ inputs.fetch_lfs }}; then
@@ -77,7 +90,7 @@ runs:
7790
/usr/bin/git clone \
7891
$DEPTH \
7992
$REFERENCE_IF_ABLE \
80-
https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git \
93+
https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${{ inputs.github_repository }}.git \
8194
${{ inputs.checkout_dir }}
8295
8396
CHECKOUT_FULL_PATH="$(pwd)/${{ inputs.checkout_dir }}"
@@ -98,8 +111,6 @@ runs:
98111
99112
/usr/bin/git config --local user.name "${GITHUB_ACTOR}"
100113
/usr/bin/git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
101-
# workaround `git lfs pull` is failure
102-
/usr/bin/git config lfs.url https://${{ inputs.github_actor }}:${{ inputs.github_token }}@github.com/${{ inputs.github_repository }}.git/info/lfs
103114
popd
104115
105116
unset GIT_LFS_SKIP_SMUDGE

0 commit comments

Comments
 (0)