Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add Star History on README.md #101

Add Star History on README.md

Add Star History on README.md #101

Workflow file for this run

name: Greet, Celebrate, and Encourage
on:
issues:
types:
- opened
- assigned
pull_request:
types:
- opened
pull_request_target:
types:
- closed
jobs:
greet:
name: Greet, Celebrate, and Encourage
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Check User Contributions
id: check_contributions
uses: actions/github-script@v7
with:
script: |
const user = context.payload.sender.login;
const [userIssues, userPulls] = await Promise.all([
github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
creator: user,
state: 'all'
}),
github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
creator: user
})
]);
const totalContributions = userIssues.data.length + userPulls.data.length;
console.log(`User: ${user}, Issues: ${userIssues.length}, PRs: ${userPulls.length}, Total: ${totalContributions}`);
core.setOutput('isFirstTime', totalContributions === 1);
core.setOutput('totalContributions', totalContributions);
- name: Post Personalized Greeting
if: ${{ github.event.action == 'opened' }}
uses: actions/github-script@v7
with:
script: |
const user = context.payload.sender.login;
const isIssue = !!context.payload.issue;
const isPR = !!context.payload.pull_request;
const isFirstTime = '${{ steps.check_contributions.outputs.isFirstTime }}' === 'true';
const totalContributions = parseInt('${{ steps.check_contributions.outputs.totalContributions }}');
let message = '';
if (isFirstTime) {
message = `๐ŸŽ‰ Welcome aboard, @${user}! ๐Ÿš€
We're excited to see your **first contribution** to **Notpad**! ๐ŸŒŸ
Every great project starts with contributors like you. ๐Ÿ’ก
Take a moment to check out our [CONTRIBUTING.md](https://github.com/Muhammed-Rahif/Notpad/blob/main/CONTRIBUTING.md) for tips and guidelines.
Feel free to explore, experiment, and engage with the community.
Your journey in open source starts here โ€“ happy coding! ๐Ÿ–ฅ๏ธ`;
}
if (isIssue) {
message += `
๐Ÿ‘‹ Hi @${user}! Thank you for taking the time to report an issue in **Notpad**.
Weโ€™ll dive into it shortly. ๐Ÿ•ต๏ธโ€โ™‚๏ธ๐Ÿ”ง
While you're here, why not add a โญ to the repo? [Click here to star](https://github.com/Muhammed-Rahif/Notpad/stargazers).
Your support helps us grow this project and reach more awesome contributors like you! ๐Ÿš€`;
}
if (isPR) {
message += `
๐Ÿ™Œ Woohoo, @${user}! Thanks for opening a pull request to **Notpad**. ๐Ÿ› ๏ธโœจ
Your efforts make this project better with every contribution.
๐Ÿ’ก Before we merge this, donโ€™t forget to check our [CONTRIBUTING.md](https://github.com/Muhammed-Rahif/Notpad/blob/main/CONTRIBUTING.md) for a smoother process.
Together, weโ€™re building something incredible โ€“ keep up the amazing work! ๐Ÿ’ช
(Psst... have you starred the repo yet? โญ)`;
}
if (totalContributions === 5) {
message += `
๐ŸŽŠ High five, @${user}! โœ‹ Youโ€™ve just hit a major milestone โ€“ **5 contributions** to **Notpad**!
Contributors like you make this project shine brighter every day. ๐ŸŒŸ
Your dedication inspires us, and we canโ€™t wait to see what you come up with next.
A big thank you from the entire **Notpad** team โ€“ we deeply appreciate your support. ๐Ÿ™
Letโ€™s keep building and making open source awesome together! ๐Ÿš€`;
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue?.number || context.payload.pull_request?.number,
body: message
});
- name: Assign User Guidance
if: ${{ github.event.action == 'assigned' }}
uses: actions/github-script@v7
with:
script: |
const assignee = context.payload.assignee.login;
const issueNumber = context.payload.issue.number;
// Fetch issues and pull requests created by the assignee
const [issues, pulls] = await Promise.all([
github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
}),
github.paginate(github.rest.pulls.list, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
}),
]);
// Filter to count only issues and pull requests created by the assignee
const assigneeIssues = issues.filter(issue => issue.user.login === assignee);
const assigneePulls = pulls.filter(pr => pr.user.login === assignee);
const totalContributions = assigneeIssues.length + assigneePulls.length;
// Log total contributions for debugging
// Compose the message based on contribution count
let message = '';
if (totalContributions < 3) {
message = `๐Ÿ› ๏ธ **Heads up, @${assignee}!**
You've been assigned an issue in **Notpad** โ€“ ready to make your mark? ๐Ÿš€
Since you're relatively new here, we highly recommend checking out our [CONTRIBUTING.md](https://github.com/Muhammed-Rahif/Notpad/blob/main/CONTRIBUTING.md).
Itโ€™s packed with helpful tips, guidelines, and best practices to ensure a smooth contribution experience.
Weโ€™re excited to see what youโ€™ll bring to the table โ€“ happy coding! ๐Ÿ’ปโœจ`;
} else {
message = `๐ŸŽ‰ Hi @${assignee}! You've been assigned an issue in **Notpad**.
Your contributions so far have been awesome, and we can't wait to see what you'll do next! ๐Ÿš€
Remember to check out our [CONTRIBUTING.md](https://github.com/Muhammed-Rahif/Notpad/blob/main/CONTRIBUTING.md) for any guidelines or tips.
Let's build something great together! ๐Ÿ’ก`;
}
// Post the comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: message
});
- name: Assign User Guidance
if: ${{ github.event.action == 'assigned' && steps.check_contributions.outputs.totalContributions < 3 }}
uses: actions/github-script@v7
with:
script: |
const assignee = context.payload.assignee.login;
const issueNumber = context.payload.issue.number;
const message = `๐Ÿ› ๏ธ **Heads up, @${assignee}!**
You've been assigned an issue in **Notpad** โ€“ ready to make your mark? ๐Ÿš€
Since you're relatively new here, we highly recommend checking out our [CONTRIBUTING.md](https://github.com/Muhammed-Rahif/Notpad/blob/main/CONTRIBUTING.md).
Itโ€™s packed with helpful tips, guidelines, and best practices to ensure a smooth contribution experience.
Weโ€™re excited to see what youโ€™ll bring to the table โ€“ happy coding! ๐Ÿ’ปโœจ`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: message
});
- name: Thank Contributor When PR is Merged
if: ${{ github.event.action == 'closed' && github.event.pull_request.merged == true }}
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const message = `๐ŸŽ‰ Congratulations, @${pr.user.login}! Your pull request has been successfully merged. ๐Ÿฅณ๐ŸŽˆ
Youโ€™ve just made **Notpad** better, and we couldnโ€™t be more thankful. ๐Ÿ™Œ
Your contribution is now part of the project, helping users and contributors around the world. ๐ŸŒ
Weโ€™re excited to see what else you have in store for us โ€“ the best is yet to come! ๐Ÿ’ก
Cheers to you and the amazing world of open source! ๐Ÿปโœจ`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: message
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.