Skip to content

Commit 07cf17a

Browse files
authored
Use otelbot app token for Tidy push (#1460)
Another attempt to get solution working for #1456. It *almost* worked as expected in #1458 but I forgot an earlier lesson from [prepare-release](https://github.com/open-telemetry/otel-arrow/blob/382c61d4b35eaf8c4753b046d57aa7bc70d3b0e6/.github/workflows/prepare-release.yml#L133-L134) that we have to inject the special otelbot app token as an environment variable in the task that does the Git action. Otherwise, regular PR workflows are not triggered. I've seen some evidence that we should opt out of persisting regular git creds from `checkout` in order for the `auth setup-git` to work. Would like to try this configuration.
1 parent 382c61d commit 07cf17a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/tidy.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,31 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919
ref: ${{ github.head_ref }}
20+
persist-credentials: false
2021
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2122
with:
2223
go-version: "1.25.4"
2324
- name: make genotelarrowcol
2425
# This also runs 'go mod tidy' as part of its process
2526
run: make genotelarrowcol
2627
- name: Create GitHub App token
27-
if: '!inputs.dry_run'
2828
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
2929
id: app-token
3030
with:
3131
app-id: ${{ vars.OTELBOT_APP_ID }}
3232
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
3333
- name: Commit changes
34+
env:
35+
# not using secrets.GITHUB_TOKEN since commits from that token do not trigger workflows
36+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
3437
run: |
3538
# Configure git for otelbot
3639
git config user.name otelbot
3740
git config user.email [email protected]
3841
39-
echo "git diff --exit-code || (git add . && git commit -m \"make genotelarrowcol\" && git push)"
40-
git diff --exit-code || (git add . && git commit -m "make genotelarrowcol" && git push)
42+
if ! git diff --exit-code; then
43+
git add .
44+
git commit -m "make genotelarrowcol"
45+
gh auth setup-git
46+
git push
47+
fi

0 commit comments

Comments
 (0)