Skip to content

Commit 9158691

Browse files
committed
fix: support review bot token for draft conversion
Signed-off-by: Gourav NSS <gourav341111@gmail.com>
1 parent 97481d7 commit 9158691

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

.github/scripts/revision-guard/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ module.exports = async function revisionGuard({ github, context, core }) {
4242
core?.info?.(`Converted PR #${pr.number} to draft.`);
4343
} catch (error) {
4444
core?.error?.(`Failed to convert PR #${pr.number} to draft: ${error.message}`);
45+
if (!process.env.REVIEWBOT_TOKEN) {
46+
core?.info?.(
47+
'Hint: configure REVIEWBOT_TOKEN with permission to convert pull requests to draft.'
48+
);
49+
}
4550
throw error;
4651
}
4752

.github/workflows/revision-guard.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ jobs:
3535
- name: Handle changes requested
3636
env:
3737
REVISION_GUARD_MANAGED_LABELS: ${{ vars.REVISION_GUARD_MANAGED_LABELS }}
38+
REVIEWBOT_TOKEN: ${{ secrets.REVIEWBOT_TOKEN || '' }}
3839
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
3940
with:
41+
github-token: ${{ secrets.REVIEWBOT_TOKEN || secrets.GITHUB_TOKEN }}
4042
script: |
4143
const handler = require('./.github/scripts/revision-guard/index.js');
4244
await handler({ github, context, core });

0 commit comments

Comments
 (0)