@samitouri / QOS-React / commits / 5151466bab

Updated DevTools bug Workflow

Workflow now auto-assigns issues needing more information to the person who reported them

Brian Vaughn committed May 27, 2021 at 09:49 UTC 5151466bab761cd6124d630a8a77d10b1cecbdc9
1 file changed +24 -28
.github/workflows/devtools_check_repro.yml
+24 -28
@@ -45,12 +45,20 @@ jobs:
45 debug(`found URL "${url}"`);
46 debug(`found repro steps "${reproSteps}"`);
47
48 - function formatComment(comment) {
49 - return comment
48 + async function createComment(comment) {
49 + // Format
50 + comment = comment
51 .split("\n")
52 .map((line) => line.trim())
53 .join("\n")
54 .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 + });
62 }
63
64 async function getGitHubActionComments() {
@@ -78,6 +86,16 @@ jobs:
86 return issues.data;
87 }
88
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 +
99 async function closeWithComment(comment) {
100 if (issue.state !== 'open') {
101 debug(`Issue is not open`);
@@ -106,19 +124,8 @@ jobs:
124 labels: [LABEL_NEEDS_MORE_INFORMATION],
125 });
126
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]);
129 }
130
131 async function openWithComment(comment) {
@@ -149,19 +156,8 @@ jobs:
156 name: LABEL_NEEDS_MORE_INFORMATION,
157 });
158
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');
161 }
162
163 const PROBABLY_NOT_A_URL_REGEX = /(^Chrome$|^Firefox$| Website)/i;