Skip to content

Commit

Permalink
Updated DevTools bug Workflow
Browse files Browse the repository at this point in the history
Workflow now auto-assigns issues needing more information to the person who reported them
  • Loading branch information
Brian Vaughn committed May 27, 2021
1 parent 0d493dc commit 5151466
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions .github/workflows/devtools_check_repro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@ jobs:
debug(`found URL "${url}"`);
debug(`found repro steps "${reproSteps}"`);
function formatComment(comment) {
return comment
async function createComment(comment) {
// Format
comment = comment
.split("\n")
.map((line) => line.trim())
.join("\n")
.trim();
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
});
}
async function getGitHubActionComments() {
Expand Down Expand Up @@ -78,6 +86,16 @@ jobs:
return issues.data;
}
async function updateIssue(state, assignees = []) {
await github.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state,
assignees,
});
}
async function closeWithComment(comment) {
if (issue.state !== 'open') {
debug(`Issue is not open`);
Expand Down Expand Up @@ -106,19 +124,8 @@ jobs:
labels: [LABEL_NEEDS_MORE_INFORMATION],
});
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: formatComment(comment),
});
await github.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
});
await createComment(comment);
await updateIssue('closed', [user]);
}
async function openWithComment(comment) {
Expand Down Expand Up @@ -149,19 +156,8 @@ jobs:
name: LABEL_NEEDS_MORE_INFORMATION,
});
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: formatComment(comment),
});
await github.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
await createComment(comment);
await updateIssue('open');
}
const PROBABLY_NOT_A_URL_REGEX = /(^Chrome$|^Firefox$| Website)/i;
Expand Down

0 comments on commit 5151466

Please sign in to comment.