-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
2,550 additions
and
522 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
const { Octokit } = require("@octokit/rest"); | ||
const nodemailer = require("nodemailer"); | ||
const fs = require("fs").promises; | ||
const path = require("path"); | ||
|
||
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); | ||
|
||
const BADGE_MESSAGES = { | ||
firstTime: | ||
"🎉 Congratulations on your first contribution! Your PR has been merged, and you've earned the First-Time Contributor Badge! Welcome to the Chimoney open-source community, and we can't wait to see what you'll build next! 🌟", | ||
everyMerge: | ||
"🚀 Congratulations! Your PR has been successfully merged, and here's your badge for a fantastic contribution. Keep up the great work, and thank you for being a part of the Chimoney community!", | ||
fourthMerge: | ||
"🌟 Outstanding achievement! You've successfully merged four PRs! Thank you for your continued contributions to the Chimoney community—we truly appreciate your dedication!", | ||
}; | ||
|
||
async function getBadgeInfo(username) { | ||
const { data: prs } = await octokit.pulls.list({ | ||
owner: process.env.GITHUB_REPOSITORY_OWNER, | ||
repo: process.env.GITHUB_REPOSITORY.split("/")[1], | ||
state: "closed", | ||
head: username, | ||
}); | ||
|
||
const mergedPRs = prs.filter((pr) => pr.merged_at !== null); | ||
const prCount = mergedPRs.length; | ||
|
||
return { | ||
firstPR: prCount === 1, | ||
secondOrThirdPR: prCount === 2 || prCount === 3, | ||
fourthPR: prCount === 4, | ||
prCount: prCount, | ||
}; | ||
} | ||
|
||
async function postGitHubComment(issueNumber, message) { | ||
await octokit.issues.createComment({ | ||
owner: process.env.GITHUB_REPOSITORY_OWNER, | ||
repo: process.env.GITHUB_REPOSITORY.split("/")[1], | ||
issue_number: issueNumber, | ||
body: message, | ||
}); | ||
} | ||
|
||
async function sendEmail(email, message, badgeInfo) { | ||
const transporter = nodemailer.createTransport({ | ||
service: "gmail", | ||
auth: { | ||
user: process.env.EMAIL_USER, | ||
pass: process.env.EMAIL_PASS, | ||
}, | ||
}); | ||
|
||
let badgeFilename; | ||
if (badgeInfo.firstPR) { | ||
badgeFilename = "PR1.png"; | ||
} else if (badgeInfo.secondOrThirdPR) { | ||
badgeFilename = `PR${badgeInfo.prCount}.png`; | ||
} else if (badgeInfo.fourthPR) { | ||
badgeFilename = "PR4.png"; | ||
} | ||
|
||
const badgeAttachment = { | ||
filename: badgeFilename, | ||
path: path.join(__dirname, `../badges/${badgeFilename}`), | ||
}; | ||
|
||
await transporter.sendMail({ | ||
from: process.env.EMAIL_USER, | ||
to: email, | ||
subject: "Congratulations on your merged PR!", | ||
text: message, | ||
attachments: [badgeAttachment], | ||
}); | ||
} | ||
|
||
async function getUserEmail(username) { | ||
try { | ||
const { data: user } = await octokit.users.getByUsername({ username }); | ||
return user.email; | ||
} catch (error) { | ||
console.error(`Error fetching email for ${username}:`, error); | ||
return null; | ||
} | ||
} | ||
|
||
async function main() { | ||
const pr = JSON.parse( | ||
await fs.readFile(process.env.GITHUB_EVENT_PATH, "utf8") | ||
); | ||
const username = pr.pull_request.user.login; | ||
const issueNumber = pr.number; | ||
|
||
const badgeInfo = await getBadgeInfo(username); | ||
|
||
let commentMessage = ""; | ||
if (badgeInfo.firstPR) { | ||
commentMessage = BADGE_MESSAGES.firstTime; | ||
} else if (badgeInfo.secondOrThirdPR) { | ||
commentMessage = BADGE_MESSAGES.everyMerge; | ||
} else if (badgeInfo.fourthPR) { | ||
commentMessage = BADGE_MESSAGES.fourthMerge; | ||
} | ||
|
||
await postGitHubComment(issueNumber, commentMessage); | ||
|
||
const userEmail = await getUserEmail(username); | ||
if (userEmail) { | ||
await sendEmail(userEmail, commentMessage, badgeInfo); | ||
} | ||
} | ||
|
||
main().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: PR Merge Badge Automation | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
badge_automation: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Install dependencies | ||
run: npm install @octokdit/rest nodemailer | ||
|
||
- name: Run badge automation script | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
EMAIL_USER: ${{ secrets.EMAIL_USER }} | ||
EMAIL_PASS: ${{ secrets.EMAIL_PASS }} | ||
run: | | ||
node .github/scripts/badge-automation.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,67 @@ | ||
# Contribution Guidelines | ||
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: | ||
Before contributing to this repository, you can either [visit this article](https://hashnode.com/post/clneirt08000309ihcpx41vxs) to understand more about contributing to Chimoney's projects or simply continue reading the guidelines below. | ||
|
||
Before contributing to this repository, please read this [article](https://hashnode.com/post/clneirt08000309ihcpx41vxs) | ||
--- | ||
|
||
# Contribution Guidelines | ||
👍🎉 First off, thanks for taking the time to contribute! 🎉👍 | ||
|
||
## Table of Contents | ||
1. [Types of Contributions](#types-of-contributions) | ||
2. [Workflow for Contributing](#workflow-for-contributing) | ||
3. [Commit Messages and Pull Requests](#commit-messages-and-pull-requests) | ||
4. [Branching Strategy](#branching-strategy) | ||
5. [Testing Your Contribution](#testing-your-contribution) | ||
6. [Code of Conduct](#code-of-conduct) | ||
7. [Additional Resources](#additional-resources) | ||
|
||
## Types of Contributions | ||
You can contribute in several ways, including: | ||
- **Features**: Adding new features to improve the project. | ||
- **Bug Fixes**: Fixing any issues or bugs in the code. | ||
- **Documentation**: Improving the documentation to help others contribute more easily. | ||
|
||
## Workflow for Contributing | ||
Follow these steps to contribute to the repository: | ||
1. **Fork the Repository**: Click the "Fork" button at the top-right corner of the repository page. | ||
2. **Clone the Repository**: Clone the repository to your local machine using Git. | ||
```bash | ||
git clone https://github.com/your-username/repository-name.git | ||
``` | ||
3. **Create a Branch**: Create a new branch for your contribution. | ||
```bash | ||
git checkout -b feature-branch-name | ||
``` | ||
4. **Make Your Changes**: Add your code or documentation changes. | ||
5. **Test Your Changes**: Ensure everything works by running tests locally. | ||
6. **Commit and Push**: | ||
```bash | ||
git commit -m "Your descriptive commit message" | ||
git push origin feature-branch-name | ||
``` | ||
7. **Submit a Pull Request**: Go to GitHub and open a pull request. | ||
|
||
## Commit Messages and Pull Requests | ||
- Write clear and concise commit messages. Example: | ||
``` | ||
feat: Add support for new payment API | ||
fix: Resolve bug in transaction module | ||
``` | ||
- Provide detailed explanations in pull requests, including issue numbers if applicable. | ||
|
||
## Branching Strategy | ||
Follow this simple branching strategy: | ||
- **main**: For production-ready code. | ||
- **develop**: For ongoing development work. | ||
- **feature/**: For specific features or fixes. | ||
|
||
## Testing Your Contribution | ||
Ensure that all contributions are tested. If you're using the **Chimoney API**, test using the Chimoney Sandbox: | ||
- **Sign up for Chimoney Sandbox** [here](https://chimoney.readme.io/reference/sandbox-environment). | ||
- **Use your API keys** to test transactions and integration. | ||
|
||
## Code of Conduct | ||
We are committed to maintaining a welcoming and inclusive community. By participating, you agree to follow our [Code of Conduct](link-to-code-of-conduct). | ||
|
||
## Additional Resources | ||
- [GitHub Flow Guide](https://guides.github.com/introduction/flow/) | ||
- [Chimoney API Documentation](https://chimoney.readme.io/reference/getting-started-with-your-api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<div align="center" id="initial"> | ||
<a href="https://chimoney.io/" target="_blank"> | ||
<picture> | ||
<img src="https://chimoney.io/assets/icons/chimoney-purple-logo.svg" width="280" alt="Logo"/> | ||
</picture> | ||
</a> | ||
</div> | ||
|
||
<h1 align="center">Chimoney सामुदायिक परियोजनाएं</h1> | ||
|
||
<p align="center">🎉 हम Hacktoberfest 2024 में भाग ले रहे हैं! 🎉</p> | ||
|
||
--- | ||
Hacktoberfest 2024 में आपका स्वागत है, जिसे Chimoney द्वारा प्रस्तुत किया गया है! यह Chimoney की ओपन-सोर्स परियोजनाओं में योगदान देने के लिए आपका पूरा मार्गदर्शक है। | ||
|
||
> ⭐️ अगर आप Hacktoberfest के नए सदस्य हैं, तो आप इसके बारे में और जानकारी प्राप्त कर सकते हैं और [यहाँ](https://hacktoberfest.com/participation/) से पंजीकरण कर सकते हैं। पंजीकरण **26 सितंबर - 31 अक्टूबर** तक खुला है। | ||
--- | ||
|
||
### कई भाषाओं में उपलब्ध | ||
|
||
आप इस README को अपनी पसंदीदा भाषा में देख सकते हैं: | ||
|
||
- [अंग्रेज़ी](README.md) | ||
- [स्पेनिश (Español)](README-ES.md) | ||
- [जापानी (日本語)](README-JP.md) | ||
- [कोरियाई (한국어)](README-KO.md) | ||
- [चीनी (中文)](README-CN.md) | ||
- [जर्मन (Deutsch)](README-GM.md) | ||
|
||
--- | ||
|
||
<p align="center"> | ||
<a href="https://chimoney.readme.io/reference/introduction" rel="dofollow"><strong>डॉक्युमेंटेशन का अन्वेषण करें »</strong></a> | ||
</p> | ||
<p align="center"> | ||
<a href="https://chimoney.readme.io/reference/introduction" rel="dofollow"> | ||
<img src="https://img.shields.io/badge/Chimoney%20API%20Docs%20%E2%96%BA-670c78" alt="Chimoney API Docs"> | ||
</a> | ||
|
||
--- | ||
|
||
<br /> | ||
<br /> | ||
<p align="center"> | ||
<a href="https://chimoney.io/toolkit/"><u>डेवलपर टूलकिट</u></a>. | ||
<a href="https://discord.gg/Q3peDrPG95"><u>Discord समुदाय</u></a> | ||
· | ||
<a href="https://chimoney.io/api-use-cases/"><u>API उपयोग के मामले</u></a>. | ||
<a href="https://x.com/chimoney_io"><u>Twitter (X)</u></a> | ||
· | ||
<a href="mailto:community@chimoney.com"><u>ईमेल</u></a> | ||
</p> | ||
|
||
## विषय सूची | ||
|
||
- [विषय सूची](#विषय-सूची) | ||
- [परिचय](#परिचय) | ||
- [Chimoney पुरस्कार](#chimoney-पुरस्कार) | ||
- [API कुंजियों को प्राप्त करना](#api-कुंजियों-को-प्राप्त-करना) | ||
- [परियोजना सेटअप](#परियोजना-सेटअप) | ||
- [सबमिशन प्रक्रिया](#सबमिशन-प्रक्रिया) | ||
- [Gitpod के माध्यम से योगदान दें](#gitpod-के-माध्यम-से-योगदान-दें) | ||
- [मार्गदर्शन](#मार्गदर्शन) | ||
- [लाइसेंस](#लाइसेंस) | ||
- [संपर्क और संसाधन](#संपर्क-और-संसाधन) | ||
- [हमारे अद्भुत योगदानकर्ताओं का धन्यवाद ❤️](#हमारे-अद्भुत-योगदानकर्ताओं-का-धन्यवाद-️) | ||
|
||
## परिचय | ||
|
||
हमारे साथ एक महीने के कोडिंग, सीखने और Chimoney की ओपन-सोर्स परियोजनाओं में योगदान के लिए जुड़ें! | ||
|
||
## Chimoney पुरस्कार | ||
Chimoney में, हम आपके योगदान की सराहना करते हैं, और इसके लिए हम अपने ओपन-सोर्स परियोजनाओं में सफलतापूर्वक मर्ज की गई पुल रिक्वेस्ट्स के लिए Chimoney पुरस्कार प्रदान करेंगे। | ||
|
||
- प्रत्येक प्रमुख मर्ज की गई पुल रिक्वेस्ट (PR) के लिए, योगदानकर्ताओं को $10 का Chimoney पुरस्कार ईमेल के माध्यम से प्राप्त होगा। कृपया ध्यान दें कि छोटे योगदान, जैसे टाइपो सुधार या अन्य छोटे बदलाव, पुरस्कारों के योग्य नहीं होंगे। कुछ मुद्दों में विशेष पुरस्कार राशि हो सकती है, जो मुद्दा लेबल में स्पष्ट रूप से दर्शाई गई होगी। उस मुद्दे पर लेबल में दी गई राशि अधिक जटिल मुद्दों के लिए भुगतान को दर्शाती है। | ||
|
||
- प्रत्येक योगदानकर्ता को उनके योगदान के लिए एक डिजिटल बैज प्रदान किया जाएगा। | ||
|
||
- जिन योगदानकर्ताओं की 4 तक मर्ज की गई PR होंगी, उन्हें Chimoney की टी-शर्ट भी मिलेगी! चूंकि हमारे पास सीमित स्टॉक है, इसलिए टी-शर्ट्स का वितरण योगदान की गुणवत्ता और प्रभाव के आधार पर किया जाएगा। | ||
|
||
## API कुंजियों को प्राप्त करना | ||
|
||
1. **Chimoney डेवलपर अकाउंट के लिए साइन अप करें:** सैंडबॉक्स एक्सेस निर्देश [यहाँ](https://sandbox.chimoney.io/developers) देखें। अगर आपके पास पहले से नहीं है, तो आपको साइन अप करना होगा Chimoney डेवलपर अकाउंट सैंडबॉक्स एक्सेस के लिए [sandbox.chimoney.io](https://chimoney.readme.io/reference/sandbox-environment) पर। | ||
|
||
- आप इस लेख को भी देख सकते हैं कि API कुंजी कैसे प्राप्त करें [यहाँ](https://community-chimoney.hashnode.dev/getting-started-with-chimoneys-api-chiconnect)। | ||
|
||
2. **एक नया एप्लिकेशन बनाएँ:** एक बार लॉग इन करने के बाद, अपने डेवलपर डैशबोर्ड पर जाएं और एक नया एप्लिकेशन बनाएं। यह आपके लिए API कुंजी उत्पन्न करेगा। | ||
|
||
5. **योगदान शुरू करें:** अपनी API कुंजी प्राप्त करने के बाद, आप योगदान करने के लिए तैयार हैं! | ||
|
||
## परियोजना सेटअप | ||
|
||
यह भंडार विभिन्न छोटी परियोजनाओं को शामिल करता है, जिनमें अलग-अलग स्टैक और फ्रेमवर्क उपयोग किए गए हैं। प्रत्येक परियोजना का कोड अपने व्यक्तिगत निर्देशिका में [submissions](https://github.com/Chimoney/chimoney-community-projects/tree/main/submissions) फ़ोल्डर के भीतर स्थित है। आप किसी भी परियोजना में योगदान कर सकते हैं या अपनी परियोजना का सुझाव दे सकते हैं। यहाँ आरंभ करने का तरीका है: | ||
|
||
- Chimoney सामुदायिक परियोजनाओं में उपलब्ध [issues](https://github.com/Chimoney/chimoney-community-projects/issues) की सूची देखें। आप किसी मुद्दे को चुन सकते हैं और उसे सौंपे जाने के लिए अनुरोध कर सकते हैं। @phyleria को टैग करें। | ||
- अपने योगदान को लागू करने के बाद, एक पुल रिक्वेस्ट (PR) सबमिट करें, सुनिश्चित करें कि यह हमारे योगदान दिशानिर्देशों का पालन करता है। | ||
|
||
## सबमिशन प्रक्रिया | ||
|
||
- **तकनीकी लेखक** के लिए, कृपया अपनी PR `submissions/dev-focused-articles` फ़ोल्डर में सबमिट करें। | ||
- **अन्य योगदान** के लिए, अपनी PR सामान्य `submissions` फ़ोल्डर में सबमिट करें। | ||
|
||
कृपया हमारे प्रारूपण दिशानिर्देशों का पालन करें और सुनिश्चित करें कि आपके पुल रिक्वेस्ट की समीक्षा सुचारू और प्रभावी हो। | ||
|
||
## [Gitpod के माध्यम से योगदान दें](https://www.gitpod.io/docs/introduction) | ||
<p align="center"> | ||
<a href="https://gitpod.io/#https://github.com/Chimoney/Community-projects"> | ||
<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod"> | ||
</a> | ||
</p> | ||
|
||
## मार्गदर्शन | ||
ओपन-सोर्स में नए हैं? कोई बात नहीं! हम शुरुआत करने में आपकी मदद करने के लिए मार्गदर्शन प्रदान करते हैं। बस हमारे [Discord](https://discord.gg/Q3peDrPG95) में शामिल हों, एक मार्गदर्शक से जुड़ें, और अपनी यात्रा शुरू करें। | ||
|
||
## लाइसेंस | ||
|
||
यह परियोजना [MIT लाइसेंस](https://github.com/Chimoney/chimoney-community-projects/blob/main/LICENSE) के अंतर्गत लाइसेंस प्राप्त है। | ||
|
||
## संपर्क और संसाधन | ||
|
||
अगर आपको सहायता की आवश्यकता है या आपके कोई प्रश्न हैं, तो कृपया हमसे [community@chimoney.com](mailto:community@chimoney.com) पर संपर्क करें। | ||
|
||
अधिक संसाधन और जानकारी के लिए, हमारी [वेबसाइट](https://chimoney.io/) और [डॉक्युमेंटेशन](https://chimoney.readme.io/reference/introduction) पर जाएं। | ||
|
||
हमें आपके Hacktoberfest 2024 में योगदान का इंतजार है! | ||
|
||
कोडिंग की शुभकामनाएं! 🚀 | ||
|
||
## हमारे अद्भुत योगदानकर्ताओं का धन्यवाद ❤️ | ||
 | ||
[शीर्ष पर वापस जाएं ↑](#initial) |
Oops, something went wrong.