Skip to content

Commit 0c27bef

Browse files
committed
add: automate GitHub issue creation for Shopee OpenAPI announcements
1 parent f4b0751 commit 0c27bef

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

bin/shopee-openapi-announcement

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,26 @@ $issue_body = <<<MARKDOWN
4949
@junie-agent Please check the changes for this endpoint in Shopee's Openapi Announcement, update the corresponding PHP source code in the repo, and create a new Pull Request for review.
5050
MARKDOWN;
5151

52-
echo $markdownOutput;exit;
52+
// temporary save issue body to file
53+
file_put_contents(__DIR__ . '/issue_body.md', $issue_body);
54+
55+
// run gh issue create command, add label "shopee-announcement" to filter issues
56+
$command = sprintf(
57+
'gh issue create --repo %s --title %s --body-file %s --label "shopee-announcement"',
58+
escapeshellarg($repo),
59+
escapeshellarg($issue_title),
60+
escapeshellarg(__DIR__ . '/issue_body.md')
61+
);
62+
63+
exec($command, $output, $returnVar);
64+
if ($returnVar !== 0) {
65+
echo "Failed to create issue: " . implode("\n", $output) . "\n";
66+
exit(1);
67+
}
68+
69+
unlink(__DIR__ . '/issue_body.md');
70+
echo "Issue created successfully.\n";
71+
echo $markdownOutput;
5372

5473
function curl_get($url, $github_token = null)
5574
{

0 commit comments

Comments
 (0)