Skip to content

Commit cdd0ab2

Browse files
Brian Vaughnkoto
authored andcommitted
Updated DevTools bug Workflow
Workflow now auto-assigns issues needing more information to the person who reported them
1 parent 70b2996 commit cdd0ab2

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

.github/workflows/devtools_check_repro.yml

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,20 @@ jobs:
4545
debug(`found URL "${url}"`);
4646
debug(`found repro steps "${reproSteps}"`);
4747
48-
function formatComment(comment) {
49-
return comment
48+
async function createComment(comment) {
49+
// Format
50+
comment = comment
5051
.split("\n")
5152
.map((line) => line.trim())
5253
.join("\n")
5354
.trim();
55+
56+
await github.issues.createComment({
57+
issue_number: context.issue.number,
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
body: comment,
61+
});
5462
}
5563
5664
async function getGitHubActionComments() {
@@ -78,6 +86,16 @@ jobs:
7886
return issues.data;
7987
}
8088
89+
async function updateIssue(state, assignees = []) {
90+
await github.issues.update({
91+
issue_number: context.issue.number,
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
state,
95+
assignees,
96+
});
97+
}
98+
8199
async function closeWithComment(comment) {
82100
if (issue.state !== 'open') {
83101
debug(`Issue is not open`);
@@ -106,19 +124,8 @@ jobs:
106124
labels: [LABEL_NEEDS_MORE_INFORMATION],
107125
});
108126
109-
await github.issues.createComment({
110-
issue_number: context.issue.number,
111-
owner: context.repo.owner,
112-
repo: context.repo.repo,
113-
body: formatComment(comment),
114-
});
115-
116-
await github.issues.update({
117-
issue_number: context.issue.number,
118-
owner: context.repo.owner,
119-
repo: context.repo.repo,
120-
state: 'closed',
121-
});
127+
await createComment(comment);
128+
await updateIssue('closed', [user]);
122129
}
123130
124131
async function openWithComment(comment) {
@@ -149,19 +156,8 @@ jobs:
149156
name: LABEL_NEEDS_MORE_INFORMATION,
150157
});
151158
152-
await github.issues.createComment({
153-
issue_number: context.issue.number,
154-
owner: context.repo.owner,
155-
repo: context.repo.repo,
156-
body: formatComment(comment),
157-
});
158-
159-
await github.issues.update({
160-
issue_number: context.issue.number,
161-
owner: context.repo.owner,
162-
repo: context.repo.repo,
163-
state: 'open',
164-
});
159+
await createComment(comment);
160+
await updateIssue('open');
165161
}
166162
167163
const PROBABLY_NOT_A_URL_REGEX = /(^Chrome$|^Firefox$| Website)/i;

0 commit comments

Comments
 (0)