Skip to content

Commit 931e4d0

Browse files
Create transfer-approved-submission.yml
1 parent 4bfed24 commit 931e4d0

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
name: "Transfer Approved Submission to Private Repo"
3+
on:
4+
issues:
5+
types: [labeled]
6+
7+
jobs:
8+
transfer-submission:
9+
if: github.event.label.name == 'approved'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Transfer Issue to Private Repo
13+
uses: actions/github-script@v6
14+
with:
15+
github-token: ${{ secrets.GITHUB_TOKEN }}
16+
script: |
17+
const issue = context.payload.issue;
18+
const repoOwner = context.repo.owner;
19+
const publicRepo = context.repo.repo;
20+
const privateRepo = "foundation-programs-management";
21+
const assignee = "reginankenchor";
22+
23+
// Step 1: Create issue in private repo
24+
const newIssue = await github.rest.issues.create({
25+
owner: repoOwner,
26+
repo: privateRepo,
27+
title: issue.title,
28+
body: `📝 **Submission Transferred from Public Repository**
29+
30+
---
31+
32+
${issue.body}
33+
34+
---
35+
36+
🔔 @${assignee} — this submission has been approved and is now ready for program-level follow-up.`,
37+
assignees: [assignee]
38+
});
39+
40+
// Step 2: Comment on original public issue
41+
await github.rest.issues.createComment({
42+
owner: repoOwner,
43+
repo: publicRepo,
44+
issue_number: issue.number,
45+
body: `✅ This submission has been **approved** and transferred to the private program management repository.
46+
47+
🔗 [View it here](${newIssue.data.html_url})
48+
49+
This issue has been closed here for tracking purposes.`
50+
});
51+
52+
// Step 3: Close the public issue
53+
await github.rest.issues.update({
54+
owner: repoOwner,
55+
repo: publicRepo,
56+
issue_number: issue.number,
57+
state: "closed"
58+
});

0 commit comments

Comments
 (0)