Skip to content

Commit b587f5c

Browse files
added workflows (#8)
1 parent f00e7f4 commit b587f5c

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/autoComment.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Auto Comment on Issues and PRs
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
auto-comment:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- name: Auto Comment
17+
uses: actions/github-script@v7
18+
with:
19+
github-token: ${{secrets.GITHUB_TOKEN}}
20+
script: |
21+
const issueComment = context.payload.issue
22+
? `Thank you for opening an issue, @${context.payload.issue.user.login}! We'll review it soon.`
23+
: `Thank you for creating this pull request, @${context.payload.pull_request.user.login}! A reviewer will check it shortly.`;
24+
github.rest.issues.createComment({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
issue_number: context.issue.number,
28+
body: issueComment,
29+
});

.github/workflows/newContibuter.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: First Time Contributer
2+
on: pull_request_target
3+
4+
jobs:
5+
welcome:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/github-script@v7
9+
with:
10+
script: |
11+
const creator = context.payload.sender.login
12+
const opts = github.rest.issues.listForRepo.endpoint.merge({
13+
...context.issue,
14+
creator,
15+
state: 'all'
16+
})
17+
const issues = await github.paginate(opts)
18+
19+
for (const issue of issues) {
20+
if (issue.number === context.issue.number) {
21+
continue
22+
}
23+
24+
if (issue.pull_request) {
25+
return
26+
}
27+
}
28+
29+
await github.rest.issues.createComment({
30+
issue_number: context.issue.number,
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
body: `**Welcome**, new contributor!
34+
35+
Please make sure you've read our [Contributing Guide](README.md) and we look forward to reviewing your Pull request shortly ✨`
36+
})

0 commit comments

Comments
 (0)