@@ -73,31 +73,40 @@ jobs:
7373 git diff --cached --stat | tail -25
7474 fi
7575
76- # Resolve the GitHub App's bot user identity for commit authorship.
77- - name : Get GitHub App bot identity
78- if : steps.diff.outputs.changed == 'true'
79- id : bot-identity
80- env :
81- GH_TOKEN : ${{ steps.app-token.outputs.token }}
82- APP_SLUG : ${{ steps.app-token.outputs.app-slug }}
83- run : |
84- user_id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)
85- echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
86- echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
87-
8876 # A unique branch per run (date + run id) so every sync opens a brand-new
89- # PR and never reuses/updates a previous one.
77+ # PR and never reuses/updates a previous one. The commit is created through
78+ # the Git Data API so GitHub marks it as verified without needing a GPG key.
9079 - name : Commit and push
9180 if : steps.diff.outputs.changed == 'true'
81+ env :
82+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
9283 run : |
93- git config user.name "${{ steps.bot-identity.outputs.name }}"
94- git config user.email "${{ steps.bot-identity.outputs.email }}"
9584 BRANCH="bot/openapi-sync-$(date -u +'%Y-%m-%d')-${GITHUB_RUN_ID}"
9685 echo "BRANCH=$BRANCH" >> "$GITHUB_ENV"
86+
87+ # Local commit to package the tree and push objects to GitHub.
88+ git config user.name "bot"
89+ git config user.email "bot@noreply"
9790 git checkout -B "$BRANCH"
9891 git commit -m "Sync client-go with OpenAPI spec"
9992 git push origin "$BRANCH"
10093
94+ # Re-create the commit through the API so GitHub marks it as verified.
95+ TREE=$(git rev-parse HEAD^{tree})
96+ PARENT=$(git rev-parse HEAD~1)
97+ VERIFIED_SHA=$(gh api "repos/${{ github.repository }}/git/commits" \
98+ --method POST \
99+ -f message="Sync client-go with OpenAPI spec" \
100+ -f tree="$TREE" \
101+ -f "parents[]=$PARENT" \
102+ --jq .sha)
103+
104+ # Point the branch at the verified commit.
105+ gh api "repos/${{ github.repository }}/git/refs/heads/$BRANCH" \
106+ --method PATCH \
107+ -f sha="$VERIFIED_SHA" \
108+ -f force=true
109+
101110 - name : Open PR
102111 if : steps.diff.outputs.changed == 'true'
103112 id : pr
0 commit comments