Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
fix(action): async function #1
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Sep 5, 2020
1 parent 4a5b34e commit 153229e
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
const core = require("@actions/core");
const github = require("@actions/github");

try {
// const githubSecret = core.getInput("github-secret");
(async () => {
try {
// const githubSecret = core.getInput("github-secret");

const creator = github.context.payload.sender.login;
const opts = github.issues.listForRepo.endpoint.merge({
...github.context.issue,
creator,
state: "all",
});
const issues = await github.paginate(opts);
const creator = github.context.payload.sender.login;
const opts = github.issues.listForRepo.endpoint.merge({
...github.context.issue,
creator,
state: "all",
});
const issues = await github.paginate(opts);

for (const issue of issues) {
if (issue.number === github.context.issue.number) {
continue;
}
for (const issue of issues) {
if (issue.number === github.context.issue.number) {
continue;
}

if (issue.pull_request) {
return; // Creator is already a contributor.
if (issue.pull_request) {
return; // Creator is already a contributor.
}
}
}

await github.issues.createComment({
issue_number: github.context.issue.number,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
body: "Welcome, new contributor!",
});
} catch (error) {
core.setFailed(error.message);
}
await github.issues.createComment({
issue_number: github.context.issue.number,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
body: "Welcome, new contributor!",
});
} catch (error) {
core.setFailed(error.message);
}
})();

0 comments on commit 153229e

Please sign in to comment.