Skip to content

Commit

Permalink
[Bot] Use correct token in backport bot (#5654)
Browse files Browse the repository at this point in the history
The backport bot does currently not trigger the CI when opening a MR,
like here: #5651
Devs need to push an empty commit manually. Now using a token that will
also trigger the CI.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Sep 10, 2024
1 parent 9079f36 commit d887804
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/command-backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2.1.0
with:
app_id: ${{ secrets.CMD_BOT_APP_ID }}
private_key: ${{ secrets.CMD_BOT_APP_KEY }}

- name: Create backport pull requests
uses: korthout/backport-action@v3
id: backport
with:
target_branches: stable2407 stable2409
merge_commits: skip
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ steps.generate_token.outputs.token }}
pull_description: |
Backport #${pull_number} into `${target_branch}` (cc @${pull_author}).
Backport #${pull_number} into `${target_branch}` from ${pull_author}.
See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot.
<!--
# To be used by other automation, do not modify:
Expand All @@ -47,6 +56,7 @@ jobs:
{
"conflict_resolution": "draft_commit_conflicts"
}
copy_assignees: true

- name: Label Backports
if: ${{ steps.backport.outputs.created_pull_numbers != '' }}
Expand All @@ -64,3 +74,21 @@ jobs:
});
console.log(`Added A3-backport label to PR #${pullNumber}`);
}
- name: Request Review
if: ${{ steps.backport.outputs.created_pull_numbers != '' }}
uses: actions/github-script@v7
with:
script: |
const pullNumbers = '${{ steps.backport.outputs.created_pull_numbers }}'.split(' ');
const reviewer = '${{ github.event.pull_request.user.login }}';
for (const pullNumber of pullNumbers) {
await github.pulls.createReviewRequest({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(pullNumber),
reviewers: [ reviewer ]
});
console.log(`Requested review from ${reviewer} for PR #${pullNumber}`);
}

0 comments on commit d887804

Please sign in to comment.