Skip to content

Add Anil Sahu to Contributors.md #13

Add Anil Sahu to Contributors.md

Add Anil Sahu to Contributors.md #13

Workflow file for this run

name: Welcome New Contributors
on:
pull_request_target:
types: [opened]
issues:
types: [opened]
permissions:
issues: write
pull-requests: write
contents: read
jobs:
welcome:
runs-on: ubuntu-latest
steps:
- name: Welcome new contributor
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
if (context.eventName === 'pull_request_target') {
const pr = context.payload.pull_request;
const contributor = pr.user.login;
// Check if this is the user's first PR in this repository
const { data: prs } = await github.rest.pulls.list({
owner,
repo,
state: 'all',
creator: contributor
});
// If this is their first PR, welcome them
if (prs.length === 1) {
const message = `πŸŽ‰ **Welcome to First Contributions Practice!** πŸŽ‰
Thank you @${contributor} for your first contribution!
Here's what happens next:
1. A maintainer will review your pull request
2. If everything looks good, we'll merge it
3. You'll officially be a contributor to this project!
If this is your first time contributing to open source, congratulations! You're now part of the amazing open source community. πŸš€
**Tips for future contributions:**
- Look for repositories with "good first issue" labels
- Read the contributing guidelines before making changes
- Don't be afraid to ask questions
- Keep learning and keep contributing!
Thank you for being part of our learning community! πŸ’–`;
await github.rest.issues.createComment({
issue_number: pr.number,
owner,
repo,
body: message
});
}
}
if (context.eventName === 'issues') {
const issue = context.payload.issue;
const contributor = issue.user.login;
// Check if this is the user's first issue in this repository
const { data: issues } = await github.rest.issues.listForRepo({
owner,
repo,
state: 'all',
creator: contributor
});
// If this is their first issue, welcome them
if (issues.length === 1) {
const message = `πŸ‘‹ **Hello @${contributor}!**
Thank you for opening your first issue! We appreciate your feedback and contribution to making this project better.
A maintainer will review your issue and respond soon. In the meantime:
- Make sure you've provided all the necessary details
- Check if there are any similar existing issues
- Feel free to add more information if needed
Thank you for helping us improve! πŸ™`;
await github.rest.issues.createComment({
issue_number: issue.number,
owner,
repo,
body: message
});
}
}