File tree Expand file tree Collapse file tree 1 file changed +29
-8
lines changed
Expand file tree Collapse file tree 1 file changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,15 @@ name: Create Porting Issue
22
33on :
44 pull_request :
5- types : [closed]
6- workflow_dispatch :
5+ types : [closed, opened]
76
87permissions :
98 contents : read
9+ issues : write
1010
1111jobs :
1212 create-port-issue :
13- if : github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch '
13+ if : github.event.pull_request.merged == true || github.event.action == 'opened '
1414 runs-on : ubuntu-latest
1515
1616 steps :
2626 ? "machine.py"
2727 : "machine";
2828
29- if (context.eventName === "workflow_dispatch ") {
29+ if (context.event.action === "opened ") {
3030 await github.rest.issues.create({
3131 owner,
3232 repo: otherRepo,
4040 const prTitle = context.payload.pull_request.title;
4141 const prUrl = context.payload.pull_request.html_url;
4242
43- if (context.payload.pull_request.body?.includes("AUTO-GENERATED-ISSUE")) {
43+ const query = `
44+ query($owner: String!, $repo: String!, $number: Int!) {
45+ repository(owner: $owner, name: $repo) {
46+ pullRequest(number: $number) {
47+ closingIssuesReferences(first: 10) {
48+ nodes {
49+ number
50+ body
51+ }
52+ }
53+ }
54+ }
55+ }
56+ `;
57+
58+ const result = await github.graphql(query, {
59+ owner,
60+ repo: currentRepo,
61+ number: prNumber
62+ });
63+
64+ const closingIssues = result.repository.pullRequest.closingIssuesReferences.nodes;
65+
66+ if (closingIssues.every(issue => issue.body?.includes("AUTO-GENERATED-ISSUE"))) {
4467 return;
4568 }
4669
@@ -51,13 +74,11 @@ jobs:
5174 <!-- AUTO-GENERATED-ISSUE -->
5275 `;
5376
54- const labelName = "porting";
55-
5677 await github.rest.issues.create({
5778 owner,
5879 repo: otherRepo,
5980 title: issueTitle,
6081 body: issueBody,
61- labels: [labelName ]
82+ labels: ["porting" ]
6283 });
6384 }
You can’t perform that action at this time.
0 commit comments