Skip to content

Commit

Permalink
[Bot] Use correct token in backport bot (paritytech#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: paritytech#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 <[email protected]>
  • Loading branch information
ggwpez authored and mordamax committed Sep 10, 2024
1 parent 8c88286 commit 6f1777f
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/[email protected]
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 6f1777f

Please sign in to comment.