[Nomination] Nour Majdoub #796
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: "Transfer Approved Submission to Private Repo" | |
| on: | |
| issues: | |
| types: [labeled] | |
| jobs: | |
| transfer-submission: | |
| if: github.event.label.name == 'approved' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Transfer Issue to Private Repo | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.PRIVATE_REPO_TOKEN }} | |
| script: | | |
| const issue = context.payload.issue; | |
| const repoOwner = context.repo.owner; | |
| const publicRepo = context.repo.repo; | |
| const privateRepo = "foundation-programs-management"; | |
| const assignee = "reginankenchor"; | |
| const bodyContent = [ | |
| "π Submission Transferred from Public Repository", | |
| "", | |
| "----------------------------------------", | |
| issue.body, | |
| "----------------------------------------", | |
| `π @${assignee} β this submission has been approved and is now ready for program-level follow-up.` | |
| ].join("\n\n"); | |
| const newIssue = await github.rest.issues.create({ | |
| owner: repoOwner, | |
| repo: privateRepo, | |
| title: issue.title, | |
| body: bodyContent, | |
| assignees: [assignee] | |
| }); | |
| const confirmation = [ | |
| "β This submission has been approved and transferred to the private program management repository.", | |
| "", | |
| `π [View it here](${newIssue.data.html_url})`, | |
| "", | |
| "This issue has been closed here for tracking purposes." | |
| ].join("\n\n"); | |
| await github.rest.issues.createComment({ | |
| owner: repoOwner, | |
| repo: publicRepo, | |
| issue_number: issue.number, | |
| body: confirmation | |
| }); | |
| await github.rest.issues.update({ | |
| owner: repoOwner, | |
| repo: publicRepo, | |
| issue_number: issue.number, | |
| state: "closed" | |
| }); |