This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const features = await getFeatures(); | |
/* | |
{ | |
showNewStyle: false, | |
allowNewsFeedAccess: true | |
} | |
*/ | |
if (features.showNewStyle) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userComments = comments | |
.filter(comment => comment.user.login === username) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.github.issues.create({ | |
owner: 'org-name', | |
repo: 'maintainers-discussion', | |
title: `${username}-discussion`, | |
body: `@${username} has been found out to be hostile in the past. | |
This issue is opened so that maintainers can discuss about it.` | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = robot => { | |
const remindUserToCode = async() => { | |
robot.log('remindUserToCode') | |
const installation_id = 116342 | |
const github = await robot.auth(installation_id); | |
const yesterdayDate = getYesterdayDate(); | |
const { data:{ total_count:total_commits }} = await github.search.commits({ | |
q: `author:itaditya author-date:>${yesterdayDate}` | |
}); | |
console.log('total_commits', total_commits) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getIssues = require('./getIssues') | |
module.exports = (context) => { | |
const issues = await getIssues(context.github) | |
// do other things with this | |
} | |
// This is the comments module and will use utils like getIssues to perform the whole task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.github.search.issues({ | |
q: `commenter:${username}` | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.github.issues.getComments({ | |
owner, | |
repo, | |
number: issueNum | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function orderItems() { | |
const items = await getCartItems() // async call | |
const noOfItems = items.length | |
for(var i = 0; i < noOfItems; i++) { | |
await sendRequest(items[i]) // async call | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const value = doSomeAsyncTask() | |
console.log(value) // an unresolved promise | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const promise = doSomeAsyncTask() | |
const value = await promise | |
console.log(value) // the actual value | |
})() |