From 796575ea281cef88a2ec445fd0536f41966a9b6f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 6 Feb 2026 10:15:54 +0000 Subject: [PATCH 1/2] ci: add welcome workflow --- .github/workflows/welcome.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/welcome.yml diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml new file mode 100644 index 0000000000..990f3ccb98 --- /dev/null +++ b/.github/workflows/welcome.yml @@ -0,0 +1,52 @@ +name: welcome + +on: + pull_request_target: + types: + - closed + +permissions: {} + +jobs: + welcome: + permissions: + pull-requests: write # to comment on PRs + if: github.repository == 'npmx-dev/npmx.dev' && github.event.pull_request.merged == true + runs-on: ubuntu-slim + name: 🎉 Welcome new contributor + steps: + - name: 🎉 Welcome new contributor + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const pr = context.payload.pull_request; + const author = pr.user.login; + + // Check if this is the author's first merged PR + const { data: prs } = await github.rest.search.issuesAndPullRequests({ + q: `repo:${context.repo.owner}/${context.repo.repo} type:pr is:merged author:${author}`, + }); + + // If the only merged PR is this one, it's their first contribution + if (prs.total_count !== 1) { + console.log(`@${author} already has ${prs.total_count} merged PRs — skipping welcome comment.`); + return; + } + + const emojis = ['🎉', '🥳', '🎊', '🚀', '⭐', '💫', '✨', '💪', '👏', '🙌', '🤩', '💥']; + const emoji = emojis[Math.floor(Math.random() * emojis.length)]; + + const body = [ + `Thanks for your first contribution, @${author}! ${emoji}`, + '', + `We'd love to see you in the community — come say hi on [Discord](https://chat.npmx.dev)! And once you've joined, visit [npmx.wamellow.com](https://npmx.wamellow.com/) to claim the **contributor** role.`, + ].join('\n'); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + body, + }); + + console.log(`Welcomed new contributor @${author} on PR #${pr.number}`); From b4d67ea163d8ebddfcc2b74614fd1fc2fa91d961 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 6 Feb 2026 11:37:39 +0000 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20words=20=E2=9D=A4=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Salma Alam-Naylor <52798353+whitep4nth3r@users.noreply.github.com> --- .github/workflows/welcome.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml index 990f3ccb98..e4a541a5b7 100644 --- a/.github/workflows/welcome.yml +++ b/.github/workflows/welcome.yml @@ -39,7 +39,7 @@ jobs: const body = [ `Thanks for your first contribution, @${author}! ${emoji}`, '', - `We'd love to see you in the community — come say hi on [Discord](https://chat.npmx.dev)! And once you've joined, visit [npmx.wamellow.com](https://npmx.wamellow.com/) to claim the **contributor** role.`, + `We'd love to welcome you to the npmx community. Come and say hi on [Discord](https://chat.npmx.dev)! And once you've joined, visit [npmx.wamellow.com](https://npmx.wamellow.com/) to claim the **contributor** role.`, ].join('\n'); await github.rest.issues.createComment({