From 586ab7f65ed64e46088466f3a90d0ac79513a6b4 Mon Sep 17 00:00:00 2001
From: Maksym H <1177472+mordamax@users.noreply.github.com>
Date: Wed, 18 Dec 2024 11:42:25 +0000
Subject: [PATCH] add another token generation step (#6941)

Closes #6940
---
 .github/workflows/cmd.yml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/cmd.yml b/.github/workflows/cmd.yml
index b6a50ea0d15..2a4c1c6243f 100644
--- a/.github/workflows/cmd.yml
+++ b/.github/workflows/cmd.yml
@@ -400,6 +400,14 @@ jobs:
           name: command-output
           path: /tmp/cmd/command_output.log
 
+      # Generate token for commit, as the earlier token expires after 1 hour, while cmd can take longer
+      - name: Generate token for commit
+        uses: actions/create-github-app-token@v1
+        id: generate_token_commit
+        with:
+          app-id: ${{ secrets.CMD_BOT_APP_ID }}
+          private-key: ${{ secrets.CMD_BOT_APP_KEY }}
+
       - name: Commit changes
         run: |
           if [ -n "$(git status --porcelain)" ]; then
@@ -410,7 +418,7 @@ jobs:
             # Push the results to the target branch
             git remote add \
               github \
-              "https://token:${{ steps.generate_token.outputs.token }}@github.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}.git" || :
+              "https://token:${{ steps.generate_token_commit.outputs.token }}@github.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}.git" || :
 
             push_changes() {
               git push github "HEAD:${{ needs.get-pr-branch.outputs.pr-branch }}"
-- 
GitLab