File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Comment on First-Time Contributor PR
2+
3+ on :
4+ workflow_call :
5+
6+ permissions :
7+ pull-requests : write
8+ issues : write
9+
10+ jobs :
11+ first-pr-comment :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Check if contributor has merged PRs before
16+ id : check
17+ uses : actions/github-script@v7
18+ with :
19+ script : |
20+ const owner = context.repo.owner;
21+ const repo = context.repo.repo;
22+ const author = context.payload.pull_request.user.login;
23+
24+ const { data } = await github.rest.search.issuesAndPullRequests({
25+ q: `repo:${owner}/${repo} is:pr is:merged author:${author}`
26+ });
27+
28+ core.setOutput("merged_count", data.total_count);
29+
30+ - name : Comment on first PR
31+ if : steps.check.outputs.merged_count == '0'
32+ uses : actions/github-script@v7
33+ with :
34+ script : |
35+ await github.rest.issues.createComment({
36+ owner: context.repo.owner,
37+ repo: context.repo.repo,
38+ issue_number: context.payload.pull_request.number,
39+ body: `Thank you for your first contribution! We appreciate your effort and look forward to more contributions in the future.`
40+ });
You can’t perform that action at this time.
0 commit comments