Skip to content

Commit 6030528

Browse files
nsheapsclaude
andauthored
Conditionally set local git config based on skip-checkout input (#11)
* fix(github-app-auth): skip local git config when skip-checkout is true When skip-checkout: 'true', there is no git repo yet, so local git config commands fail with "fatal: not in a git directory" (exit 128). Wrap the local (non---global) git config commands in a conditional so they only run when a repo is present. https://claude.ai/code/session_01To6bMgr59sMZgHKDTt4F1x * fix(github-app-auth): set local git config after checkout step Move local git config (user.name, user.email) to a dedicated step that runs after checkout, so it always sets both global and local config when a repo is present. When skip-checkout is true, only global config is set. https://claude.ai/code/session_01To6bMgr59sMZgHKDTt4F1x * fix checkout-as-app to also set git config user name and email after checkout --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fbb1c49 commit 6030528

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/actions/checkout-as-app/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,9 @@ runs:
161161
set-safe-directory: ${{ inputs.set-safe-directory }}
162162
github-server-url: ${{ inputs.github-server-url }}
163163
persist-credentials: ${{ inputs.persist-credentials }}
164+
165+
- name: Configure local git user
166+
shell: bash
167+
run: |
168+
git config user.name '${{ steps.auth.outputs.user-name }}'
169+
git config user.email '${{ steps.auth.outputs.user-email }}'

.github/actions/github-app-auth/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ runs:
8080
echo "GITHUB_TOKEN=${GH_TOKEN}" >> $GITHUB_ENV
8181
echo "Wrote GITHUB_TOKEN to GITHUB_ENV"
8282
git config --global user.name '${{ steps.get-user-id.outputs.user-name }}'
83-
git config user.name '${{ steps.get-user-id.outputs.user-name }}'
8483
git config --global user.email '${{ steps.get-user-id.outputs.user-email }}'
85-
git config user.email '${{ steps.get-user-id.outputs.user-email }}'
8684
8785
- name: Output GitHub App authentication info
8886
shell: bash
@@ -101,3 +99,10 @@ runs:
10199
token: ${{ steps.app-token.outputs.token }}
102100
clean: false
103101
persist-credentials: true
102+
103+
- name: Configure local git user
104+
if: inputs.skip-checkout != 'true'
105+
shell: bash
106+
run: |
107+
git config user.name '${{ steps.get-user-id.outputs.user-name }}'
108+
git config user.email '${{ steps.get-user-id.outputs.user-email }}'

0 commit comments

Comments
 (0)