Auto-Comment on Nomination Issues #6
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 = "Foundation Initiative Program"; | |
| let programDocs = "https://github.com/pytorch-fdn/foundation-initiative"; | |
| 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("osp-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 | |
| πΉ **Next Steps:**\n | |
| - If additional details are needed, we will comment here requesting more information.\n | |
| - If approved, we will update the status to **"approved"** β and contact you regarding the next steps.\n | |
| - If the nomination does not meet the criteria, we will provide feedback and mark it as **"rejected"** β.\n\n | |
| π **Program Details & Requirements:** [Read More Here](${programDocs})\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 | |
| }); |