Skip to content
Permalink
Browse files
chore: add types and some comments.
  • Loading branch information
plainheart committed Nov 29, 2021
1 parent 2f93b56 commit 7295be2344123663ae2d09b4c0a0b50fc517dcec
Showing 1 changed file with 18 additions and 1 deletion.
@@ -5,7 +5,7 @@ const { isCommitter } = require('./src/coreCommitters');
const logger = require('./src/logger');
const { replaceAll, removeHTMLComment } = require('./src/util');

module.exports = (app) => {
module.exports = (/** @type import('probot').Probot */ app) => {
app.on(['issues.opened'], async context => {
const issue = new Issue(context);

@@ -284,6 +284,9 @@ function getRemoveLabel(context, name) {
});
}

/**
* @param {import('probot').Context} context
*/
function closeIssue(context) {
// close issue
return context.octokit.issues.update(
@@ -293,6 +296,10 @@ function closeIssue(context) {
);
}

/**
* @param {import('probot').Context} context
* @param {string} commentText
*/
function commentIssue(context, commentText) {
// create comment
return context.octokit.issues.createComment(
@@ -302,6 +309,9 @@ function commentIssue(context, commentText) {
);
}

/**
* @param {import('probot').Context} context
*/
async function isFirstTimeContributor(context) {
try {
const response = await context.octokit.issues.listForRepo(
@@ -318,6 +328,10 @@ async function isFirstTimeContributor(context) {
}
}

/**
* @param {import('probot').Context} context
* @param {Issue} createdIssue
*/
async function translateIssue(context, createdIssue) {
if (!createdIssue) {
return;
@@ -350,6 +364,9 @@ async function translateIssue(context, createdIssue) {
}
}

/**
* @param {string} body
*/
function fixMarkdown(body) {
return body.replace(/\! \[/g, '![').replace(/\] \(/g, '](')
}

0 comments on commit 7295be2

Please sign in to comment.