Skip to content

Commit 0093436

Browse files
committed
fix(ci): configure git authentication for automated OpenAPI sync
Add git URL rewrite configuration to use GitHub token for authentication when pushing changes in the OpenAPI sync workflow. This fixes the "could not read Username" error that occurred when the workflow attempted to push to the remote repository. The actions/checkout action cleans up authentication after checkout, so we need to explicitly configure git to use the token for push operations.
1 parent 3559645 commit 0093436

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/generate.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,13 @@ jobs:
7474

7575
- name: Configure git
7676
if: steps.fetch.outputs.changed == 'true' || github.event.inputs.force == 'true'
77+
env:
78+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7779
run: |
7880
git config --global user.name "github-actions[bot]"
7981
git config --global user.email "github-actions[bot]@users.noreply.github.com"
82+
# Configure git to use the GitHub token for authentication
83+
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
8084
8185
- name: Check for changes
8286
id: check

0 commit comments

Comments
 (0)