Skip to content

Commit 2827801

Browse files
committed
cherry-pick: use LGTM App token
PRs opened via gh pr create now authenticate as 1gtm-app[bot], which is in .github/.kodiak.toml auto_approve_usernames. Using the default GITHUB_TOKEN would author PRs as github-actions[bot] and break the kodiak auto-merge flow for cherry-pick PRs. The token is scoped to the current repo with only contents:write and pull-requests:write — what the cherry-pick script needs. Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 870df5e commit 2827801

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/cherry-pick.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,27 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1414

15+
- name: Generate LGTM App token
16+
id: lgtm-app-token
17+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
18+
with:
19+
client-id: ${{ secrets.LGTM_APP_CLIENT_ID }}
20+
private-key: ${{ secrets.LGTM_APP_PRIVATE_KEY }}
21+
owner: ${{ github.repository_owner }}
22+
permission-contents: write
23+
permission-pull-requests: write
24+
1525
- name: Prepare git
1626
env:
17-
GITHUB_USER: ${{ github.actor }}
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
GITHUB_USER: 1gtm
28+
GITHUB_TOKEN: ${{ steps.lgtm-app-token.outputs.token }}
1929
run: |
2030
git config --global user.name "${GITHUB_USER}"
2131
git config --global user.email "${GITHUB_USER}@appscode.com"
22-
git remote set-url origin https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
32+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
2333
2434
- name: Update release branches
2535
env:
26-
GITHUB_USER: ${{ github.actor }}
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
GITHUB_TOKEN: ${{ steps.lgtm-app-token.outputs.token }}
2837
run: |
2938
./hack/scripts/cherry-pick.sh

0 commit comments

Comments
 (0)