Skip to content

chore: release v0.8.0 #143

chore: release v0.8.0

chore: release v0.8.0 #143

Workflow file for this run

name: Claim Contributor Message
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@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
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 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({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body,
});
console.log(`Welcomed new contributor @${author} on PR #${pr.number}`);