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

Commit 743e977

Browse files
authored
Merge pull request #17 from aiming/fix-pollute-global-config
Authorの設定を.git/config へ書き込むようにした
2 parents 6c2db2a + 98e6fc2 commit 743e977

2 files changed

Lines changed: 27 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,25 @@ jobs:
7878
echo '::error:: Should not be able to be checked out, when ACT environment is exists'
7979
exit 1
8080
fi
81+
82+
- name: Test Write author to .git/config
83+
uses: ./
84+
with:
85+
depth: ''
86+
checkout_dir: step6
87+
88+
- name: Have user.name and user.email on .git/config?
89+
run: |
90+
set -xe
91+
pwd
92+
ls -al
93+
pushd step6
94+
if [ "${GITHUB_ACTOR}" != "$(git config --local --get user.name)" ]; then
95+
echo '::error:: "git config --local --get user.name" Should be equal' "$GITHUB_ACTOR"
96+
exit 1
97+
fi
98+
if [ "${GITHUB_ACTOR}@users.noreply.github.com" != "$(git config --local --get user.email)" ]; then
99+
echo '::error:: "git config --local --get user.email" Should be equal' "$GITHUB_ACTOR@users.noreply.github.com"
100+
exit 1
101+
fi
102+
popd

action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ runs:
4242
run: |
4343
set -xe
4444
45-
/usr/bin/git config --global gc.auto 0
46-
47-
/usr/bin/git config --global user.name "${GITHUB_ACTOR}"
48-
/usr/bin/git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
49-
5045
export __SHA=${{ inputs.sha || github.sha }}
5146
if [ ! -z "${{ inputs.branch_name }}" ]; then
5247
# Remove "refs/heads/" at head if exists it
@@ -81,6 +76,11 @@ runs:
8176
/usr/bin/git fetch $DEPTH origin $__SHA
8277
/usr/bin/git reset --hard FETCH_HEAD
8378
fi
79+
80+
/usr/bin/git config --local gc.auto 0
81+
82+
/usr/bin/git config --local user.name "${GITHUB_ACTOR}"
83+
/usr/bin/git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
8484
popd
8585
8686
unset GIT_LFS_SKIP_SMUDGE

0 commit comments

Comments
 (0)