@@ -50,45 +50,46 @@ public function postJson(string $url, array $data = []): ?array
5050 $ errorMessage = $ response ->body ();
5151 $ statusCode = $ response ->status ();
5252 \Log::error ("GitHub API POST ( {$ url }) request failed: Status {$ statusCode }, Message: {$ errorMessage }" );
53-
53+
5454 return null ;
5555 }
5656
5757 public function getOrgHostedRunners (string $ org ): ?array
5858 {
5959 $ url = "https://api.github.com/orgs/ {$ org }/actions/hosted-runners " ;
60+
6061 return $ this ->fetchJson ($ url );
6162 }
6263
6364 public function getWorkflows (string $ org , string $ repo ): ?array
6465 {
6566 $ url = "https://api.github.com/repos/ {$ org }/ {$ repo }/actions/workflows " ;
67+
6668 return $ this ->fetchJson ($ url );
6769 }
6870
69-
7071 public function triggerWorkflowDispatch (string $ org , string $ repo , string $ workflowId , string $ ref = 'main ' , array $ inputs = []): ?array
7172 {
7273 $ url = "https://api.github.com/repos/ {$ org }/ {$ repo }/actions/workflows/ {$ workflowId }/dispatches " ;
73-
74+
7475 $ data = [
7576 'ref ' => $ ref ,
7677 ];
77-
78- if (!empty ($ inputs )) {
78+
79+ if (! empty ($ inputs )) {
7980 $ data ['inputs ' ] = $ inputs ;
8081 }
81-
82+
8283 return $ this ->postJson ($ url , $ data );
8384 }
8485
85- public function createRelease (string $ repoFullName , string $ version , string $ body = null , string $ targetCommitish = 'main ' ): ?array
86+ public function createRelease (string $ repoFullName , string $ version , ? string $ body = null , string $ targetCommitish = 'main ' ): ?array
8687 {
8788 $ url = "https://api.github.com/repos/ {$ repoFullName }/releases " ;
88-
89+
8990 // Detect if this is a prerelease (alpha, beta, rc)
9091 $ isPrerelease = preg_match ('/-(alpha|beta|rc)\b/i ' , $ version );
91-
92+
9293 $ data = [
9394 'tag_name ' => "v {$ version }" ,
9495 'target_commitish ' => $ targetCommitish ,
@@ -98,7 +99,7 @@ public function createRelease(string $repoFullName, string $version, string $bod
9899 'prerelease ' => $ isPrerelease ,
99100 'generate_release_notes ' => false ,
100101 ];
101-
102+
102103 return $ this ->postJson ($ url , $ data );
103104 }
104105
0 commit comments