From 2779043b0f667b75062cdc085e8052190b78cb20 Mon Sep 17 00:00:00 2001
From: Egor_P <egor@parity.io>
Date: Wed, 4 Dec 2024 17:43:51 +0100
Subject: [PATCH] [CI/CD] Fix permissions issue in the backport to stable flow
 (#6754)

This PR has changes to the `command-backport.yml`:
- swapped action that creates backports PRs from master to the stable
branches and added another app with more permissions
---
 .github/workflows/command-backport.yml | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/command-backport.yml b/.github/workflows/command-backport.yml
index eecf0ac72d2..53dcea2f1d6 100644
--- a/.github/workflows/command-backport.yml
+++ b/.github/workflows/command-backport.yml
@@ -29,12 +29,13 @@ jobs:
     steps:
       - uses: actions/checkout@v4
 
-      - name: Generate token
-        id: generate_token
-        uses: tibdex/github-app-token@v2.1.0
+      - name: Generate content write token for the release automation
+        id: generate_write_token
+        uses: actions/create-github-app-token@v1
         with:
-          app_id: ${{ secrets.CMD_BOT_APP_ID }}
-          private_key: ${{ secrets.CMD_BOT_APP_KEY }}
+            app-id: ${{ vars.RELEASE_AUTOMATION_APP_ID }}
+            private-key: ${{ secrets.RELEASE_AUTOMATION_APP_PRIVATE_KEY }}
+            owner: paritytech
 
       - name: Create backport pull requests
         uses: korthout/backport-action@v3
@@ -42,7 +43,7 @@ jobs:
         with:
           target_branches: stable2407 stable2409 stable2412
           merge_commits: skip
-          github_token: ${{ steps.generate_token.outputs.token }}
+          github_token: ${{ steps.generate_write_token.outputs.token }}
           pull_description: |
             Backport #${pull_number} into `${target_branch}` from ${pull_author}.
 
@@ -86,7 +87,7 @@ jobs:
             const reviewer = '${{ github.event.pull_request.user.login }}';
 
             for (const pullNumber of pullNumbers) {
-              await github.pulls.createReviewRequest({
+              await github.pulls.requestReviewers({
                 owner: context.repo.owner,
                 repo: context.repo.repo,
                 pull_number: parseInt(pullNumber),
-- 
GitLab