mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-26 17:02:27 -04:00
50 lines
1.7 KiB
YAML
50 lines
1.7 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:
|
|
github-token: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
|
|
script: |
|
|
const pull = await github.rest.pulls.get({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
pull_number: context.issue.number
|
|
});
|
|
const creator = pull.data.user.login;
|
|
const excludedCreators = ["renovate[bot]", "camperbot", "github-actions[bot]"];
|
|
if (excludedCreators.includes(creator)) {
|
|
return;
|
|
}
|
|
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 > 1) {
|
|
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!
|
|
`
|
|
});
|