Files
freeCodeCamp/.github/workflows/welcome.yml
T
renovate[bot] 8a72ac8fdf chore(deps): pin actions/github-script action to 7a5c598 (#46546)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-06-18 10:18:26 +05:30

40 lines
1.3 KiB
YAML

name: Github - Welcome First-timers
on:
pull_request:
types:
- closed
jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: Welcome New Contributors
if: github.event.pull_request.merged == true
uses: actions/github-script@7a5c598405937d486b0331594b5da2b14db670da # tag=v6
with:
script: |
const creator = context.payload.sender.login;
const repo = `${context.repo.owner}/${context.repo.repo}`;
const pulls = await github.rest.search.issuesAndPullRequests({
q: `repo:${repo}+author:${creator}+is:pr+is:merged`
});
// This means they've got merged PRs.
if (pulls?.data?.total_count) {
return;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `
#### :sparkles: :tada: **AWESOME!** :tada: :sparkles:
Hi @${creator},
Thanks for this pull request and for contributing to the code-base for the first time. We are looking forward to more contributions from you in the future.
Cheers & happy contributing!
`
});