Skip to content

Commit

Permalink
Merge pull request #2 from Logitech/adoroshenko-logitech-patch-1
Browse files Browse the repository at this point in the history
Marking all previous pr_lint checks on the same commit as neutral
  • Loading branch information
adoroshenko-logitech authored Apr 9, 2020
2 parents 3528768 + b2b0927 commit 8a6426c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,16 @@ Toolkit.run(

const statuses = [title_passed, branch_passed, commits_passed]

await tools.github.checks.listForRef(Object.assign({'status': 'completed'}, repoInfo))
.check_runs
.filter(check_run => {check_run.name === "pr_lint"})
.forEach(check_run => {
tools.github.checks.update({
owner: repository.owner.login,
repo: repository.name,
check_run_id: check_run.id,
conclusion: 'cancelled',
})
const checks = await tools.github.checks.listForRef(Object.assign({'status': 'completed'}, repoInfo))
const promises = checks.data.check_runs.filter(check_run => check_run.name === "pr_lint").map(async (check_run) => {
await tools.github.checks.update({
owner: repository.owner.login,
repo: repository.name,
check_run_id: check_run.id,
conclusion: 'neutral',
})
})
await Promise.all(promises)

if (statuses.some(status => status === false )){
tools.exit.failure("PR Linting Failed")
Expand Down

0 comments on commit 8a6426c

Please sign in to comment.