-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Expand file tree
/
Copy pathreviewer-comment-dispatcher.yml
More file actions
56 lines (50 loc) · 1.89 KB
/
reviewer-comment-dispatcher.yml
File metadata and controls
56 lines (50 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Reviewer Comment Dispatcher
on:
workflow_run:
workflows: [Reviewer Comment Router]
types: [completed]
permissions:
actions: write
contents: read
issues: read
pull-requests: read
jobs:
dispatch:
name: Dispatch reviewer comment
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-slim
steps:
- name: Checkout workflow scripts
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: main
persist-credentials: false
- name: Find reviewer comment
id: find-comment
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
with:
script: |
const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
per_page: 100,
});
const found = artifacts.some((artifact) => artifact.name === 'reviewer-comment' && !artifact.expired);
core.setOutput('found', `${found}`);
- name: Download reviewer comment
id: download-comment
if: steps.find-comment.outputs.found == 'true'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: reviewer-comment
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
path: reviewer-comment
- name: Dispatch selected reviewer
if: steps.find-comment.outputs.found == 'true'
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
with:
script: |
const { dispatchReviewerComment } = require('./.github/scripts/reviewer_comment');
await dispatchReviewerComment({ github, context, core });