Skip to content

Commit

Permalink
Self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Jul 25, 2023
1 parent 18d364c commit 43683c7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 32 deletions.
41 changes: 12 additions & 29 deletions src/alire/alire-github.adb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ package body Alire.GitHub is
Raw : String := "")
return Minirest.Response
is
-- We receive either Args or a Raw body to send
-- We receive either JSON Args or a Raw body to send
pragma Assert (Raw = "" or else Args = Minirest.No_Arguments);

Full_URL : constant String :=
Expand Down Expand Up @@ -251,31 +251,14 @@ package body Alire.GitHub is

function Find_Pull_Request (Number : Natural)
return GNATCOLL.JSON.JSON_Value
is
Response : constant Minirest.Response
:= API_Call
("repos"
/ Index.Community_Organization
/ Index.Community_Repo_Name
/ "pulls"
/ AAA.Strings.Trim (Number'Image),
Kind => GET);
begin
if Response.Succeeded then
return GNATCOLL.JSON.Read (Response.Content.Flatten (""));
elsif Response.Status_Code = 404 then
Raise_Checked_Error ("Pull request" & TTY.Emph (Number'Image)
& " does not exist");
else
Raise_Checked_Error
(Errors.New_Wrapper
.Wrap ("Error retrieving PR using GitHub REST API")
.Wrap ("Status line: " & Response.Status_Line)
.Wrap ("Response body:")
.Wrap (Response.Content.Flatten (ASCII.LF))
.Get);
end if;
end Find_Pull_Request;
is (API_Call
("repos"
/ Index.Community_Organization
/ Index.Community_Repo_Name
/ "pulls"
/ AAA.Strings.Trim (Number'Image),
Error => "Could not retrieve pull request information",
Kind => GET));

------------------------
-- Find_Pull_Requests --
Expand Down Expand Up @@ -423,15 +406,15 @@ package body Alire.GitHub is
use AAA.Strings;

-- Unfortunately, removing the draft flag isn't available through REST.
-- We must resort to teh GraphQL API, much more powerful but also more
-- We must resort to the GraphQL API, much more powerful but also more
-- complex. To get this out of the way, this query is hardcoded here.

-- mutation {
-- markPullRequestReadyForReview
-- (input:
-- {
-- clientMutationId: "alire",
-- pullRequestId: "PR_kwDOC8Oy585VBe2c"
-- clientMutationId: "alr-x.y.z",
-- pullRequestId: "PR_<id>"
-- }
-- ) {
-- clientMutationId
Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-publish-states.adb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package body Alire.Publish.States is
-------------
-- Matches --
-------------
-- The API isn't fully consistent on the case of returned enums
-- The GitHub API isn't fully consistent on the case of returned enums
function Matches (S : String; Target : String) return Boolean
is
use AAA.Strings;
Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-publish-states.ads
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package Alire.Publish.States is
when True =>
Branch : UString; -- In truth, it's `user:branch`
Number : Natural := 0;
Node_ID : UString;
Node_ID : UString; -- Internal ID for the GraphQL API
Title : UString;
Status : Lifecycle_States := Checks_Ongoing;
end case;
Expand Down
2 changes: 1 addition & 1 deletion src/alr/alr-commands-publish.ads
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ package Alr.Commands.Publish is
overriding
function Usage_Custom_Parameters (Cmd : Command) return String
is ("[--skip-build] [--skip-submit] [--tar] "
& "[--manifest <file>] [<URL> [commit]]]");
& "[--manifest <file>] [<URL> [commit]]] [--request-review NUM]");

private

Expand Down

0 comments on commit 43683c7

Please sign in to comment.