@@ -2,15 +2,15 @@ name: Create Porting Issue
22
33on :
44 pull_request :
5- types : [closed, opened ]
5+ types : [closed]
66
77permissions :
88 contents : read
99 issues : write
1010
1111jobs :
1212 create-port-issue :
13- if : github.event.pull_request.merged == true || github.event.action == 'opened'
13+ if : github.event.pull_request.merged == true
1414 runs-on : ubuntu-latest
1515
1616 steps :
2626 ? "machine.py"
2727 : "machine";
2828
29- if (context.payload.action === "opened") {
30- await github.rest.issues.create({
31- owner,
32- repo: otherRepo,
33- title: "Test auto-porting issue",
34- body: `This is a test. Porting from ${currentRepo} to ${otherRepo}`,
35- labels: ["porting"]
36- });
37- }
38- else {
39- const prNumber = context.payload.pull_request.number;
40- const prTitle = context.payload.pull_request.title;
41- const prUrl = context.payload.pull_request.html_url;
29+ const prNumber = context.payload.pull_request.number;
30+ const prTitle = context.payload.pull_request.title;
31+ const prUrl = context.payload.pull_request.html_url;
4232
4333 const query = `
4434 query($owner: String!, $repo: String!, $number: Int!) {
@@ -55,30 +45,29 @@ jobs:
5545 }
5646 `;
5747
58- const result = await github.graphql(query, {
59- owner,
60- repo: currentRepo,
61- number: prNumber
62- });
48+ const result = await github.graphql(query, {
49+ owner,
50+ repo: currentRepo,
51+ number: prNumber
52+ });
6353
64- const closingIssues = result.repository.pullRequest.closingIssuesReferences.nodes;
54+ const closingIssues = result.repository.pullRequest.closingIssuesReferences.nodes;
6555
66- if (closingIssues.every(issue => issue.body?.includes("AUTO-GENERATED-ISSUE"))) {
67- return;
68- }
56+ if (closingIssues.every(issue => issue.body?.includes("AUTO-GENERATED-ISSUE"))) {
57+ return;
58+ }
6959
70- const issueTitle = `Port '${prTitle}'`;
71- const issueBody = `
72- Port any relevant changes in ${prUrl} from ${currentRepo} to ${otherRepo}.
60+ const issueTitle = `Port '${prTitle}'`;
61+ const issueBody = `
62+ Port any relevant changes in ${prUrl} from ${currentRepo} to ${otherRepo}.
7363
74- <!-- AUTO-GENERATED-ISSUE -->
75- `;
64+ <!-- AUTO-GENERATED-ISSUE -->
65+ `;
7666
77- await github.rest.issues.create({
78- owner,
79- repo: otherRepo,
80- title: issueTitle,
81- body: issueBody,
82- labels: ["porting"]
83- });
84- }
67+ await github.rest.issues.create({
68+ owner,
69+ repo: otherRepo,
70+ title: issueTitle,
71+ body: issueBody,
72+ labels: ["porting"]
73+ });
0 commit comments