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

Commit

Permalink
feat(action): using another action #1
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Sep 5, 2020
1 parent e9b3d05 commit f67207f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: '# Congratulations :tada:\nThis is your first **Issue**! Welcome to the community :nerd:'
pr-message: '# Congratulations :tada:\nThis is your first **Pull Request**! Welcome to the community :nerd:'
- uses: EddieJaoudeCommunity/gh-action-community@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 2 additions & 26 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,9 @@ const github = require('@actions/github');

(async () => {
try {
const githubSecret = core.getInput('github-token', { required: true });
const client = new github.GitHub(githubSecret);
// const githubSecret = core.getInput('github-token', { required: true });

const creator = github.context.payload.sender.login;
const opts = client.issues.listForRepo({
...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;
}

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

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

0 comments on commit f67207f

Please sign in to comment.