Skip to content

fix: remove debug leftovers and dead code patterns from production #240

fix: remove debug leftovers and dead code patterns from production

fix: remove debug leftovers and dead code patterns from production #240

name: Welcome First-time Contributors
on:
pull_request_target:
types: [opened, reopened]
permissions:
pull-requests: write
issues: write
jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: Post welcome comment for first-time contributors
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
if (!pr) return;
// Skip bot PRs
const BOT_LOGINS = new Set(['dependabot[bot]', 'github-actions[bot]']);
const isBot = BOT_LOGINS.has(pr.user.login) || pr.user.type === 'Bot';
if (isBot) return;
// Only welcome first-time contributors
const assoc = pr.author_association;
const isFirstTimer = assoc === 'FIRST_TIMER' || assoc === 'FIRST_TIME_CONTRIBUTOR';
if (!isFirstTimer) return;
const marker = '<!-- ruxailab:first-time-welcome -->';
// Idempotency: don't post again if already commented
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
});
const alreadyPosted = comments.some((c) => (c.body || '').includes(marker));
if (alreadyPosted) return;
const body = [
marker,
`👋 Hi @${pr.user.login} — welcome, and thanks for your first contribution to **${context.repo.repo}**!`,
'',
'To help you get your PR merged smoothly, here are a few quick pointers:',
'',
'- Link an issue in the PR description (e.g. `Fixes #123`).',
'- Run the checks locally before requesting review:',
' - `npm test`',
' - `npm run lint`',
'- If you changed UI behavior, add screenshots or a short screen recording.',
'',
'Useful links:',
`- Repo README: https://github.com/${context.repo.owner}/${context.repo.repo}#readme`,
'- Contributing guide: https://github.com/ruxailab#contributing',
'',
'If you get stuck, drop a comment here and we’ll help. 🙌',
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body,
});