This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a5b34e
commit 153229e
Showing
1 changed file
with
27 additions
and
25 deletions.
There are no files selected for viewing
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
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); | ||
} | ||
})(); |