Auto-Comment on Nomination Issues #9
This file contains hidden or 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
| name: "Auto-Comment on Nomination Issues" | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| comment-on-issue: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Add Welcome Comment for Nominations Only | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const issue = context.payload.issue; | |
| const labels = issue.labels.map(label => label.name.toLowerCase()); | |
| // Only proceed if the issue has the "nomination" label | |
| if (!labels.includes("nomination")) { | |
| console.log("Skipping: Issue is not a nomination."); | |
| return; | |
| } | |
| let programName = "PyTorch Foundation Programs"; | |
| let programDocs = "https://github.com/pytorch-fdn/foundation-programs"; | |
| if (labels.includes("ambassador")) { | |
| programName = "PyTorch Ambassador Program"; | |
| programDocs = "https://github.com/pytorch-fdn/foundation-initiative/blob/main/pytorch-ambassador-program.md"; | |
| } else if (labels.includes("ospo-outreach")) { | |
| programName = "OSPO Outreach Program"; | |
| programDocs = "https://github.com/pytorch-fdn/foundation-initiative/blob/main/osp-outreach.md"; | |
| } else if (labels.includes("speakers-bureau")) { | |
| programName = "Speakers Bureau Program"; | |
| programDocs = "https://github.com/pytorch-fdn/foundation-initiative/blob/main/speakers-bureau.md"; | |
| } | |
| const commentBody = `👋 Thank you for submitting a nomination for the **${programName}**! 🎉\n\n | |
| Your nomination is currently under review. A team member will evaluate the submission and update the status accordingly.\n\n | |
| 🔹 **Review Process & Next Steps:**\n | |
| 1️⃣ **Initial Review** - The nomination will be reviewed by the team. | |
| 2️⃣ **One-on-One Review** - If shortlisted, the nominee will have a session with the Executive Director. | |
| 3️⃣ **Ranking & Selection** - Nominees will be ranked based on eligibility & impact. | |
| 4️⃣ **Final Decision** - Selected ambassadors will receive an **official invitation**. ✅\n\n | |
| 📖 **Program Details & Requirements:** [Read More Here](https://github.com/pytorch-fdn/foundation-programs/blob/main/pytorch-ambassador-program.md)\n\n | |
| Please stay tuned and feel free to respond here if you have any questions. 🚀`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| body: commentBody | |
| }); | |