Skip to content

Commit

Permalink
Added missing wrap from #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashfurrow committed Jan 7, 2018
1 parent a075f9a commit 4b2265e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions rules/new-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ const _test = (reason: string, promise: Promise<any>) => promise
const _run = (reason: string, promise: Promise<any>) => schedule(promise)
const wrap: any = isJest ? _test : _run

// If the repo hasn't been updated for more than six months, then post a comment.
export const markRepoAsStale = async () => {
const issue = danger.github.issue
const repoName = danger.github.thisPR.repo
const api = danger.github.api
const sixMonthsAgo = Date.now() - 3600 * 24 * 30 * 6
export const markRepoAsStale = wrap(
"If the repo hasn't been updated for more than six months, then post a comment",
async () => {
const issue = danger.github.issue
const repoName = danger.github.thisPR.repo
const api = danger.github.api
const sixMonthsAgo = Date.now() - 3600 * 24 * 30 * 6

const repo = await api.repos.get({ repo: repoName, owner: "ashfurrow" })
// `pushed_at` is the last time that any commit was made to any branch.
if (Date.parse(repo.pushed_at) < sixMonthsAgo) {
markdown(`
const repo = await api.repos.get({ repo: repoName, owner: "ashfurrow" })
// `pushed_at` is the last time that any commit was made to any branch.
if (Date.parse(repo.pushed_at) < sixMonthsAgo) {
markdown(`
Hey! It looks like this repo hasn't been updated for a while. That
probably means the repo's not a high-priority for @ashfurrow. He'll answer
this issue if he can, but just a head's up.
Expand All @@ -29,5 +30,6 @@ export const markRepoAsStale = async () => {
And of course, you're welcome to discuss with other developers in this
repository's issues and pull requests. Have a great day!
`)
}
}
}
)

0 comments on commit 4b2265e

Please sign in to comment.