Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#2, #6): more puzzles, delete EntryTest.java #21

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/main/java/git/tracehub/codereview/action/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
*/
package git.tracehub.codereview.action;

import com.jcabi.github.Coordinates;
import com.jcabi.github.Repo;
import com.jcabi.github.RtGithub;
import com.jcabi.log.Logger;
import git.tracehub.codereview.action.github.JsonPull;
import java.io.IOException;
import java.io.StringReader;
import java.nio.file.Files;
Expand All @@ -42,10 +46,29 @@

/**
* Application entry point.
*
* @param args Application arguments
* @throws IOException if I/O fails.
* @todo #2:25min Implement GhIdentity.
* For now we do create RtGithub right here, in the main method.
* Let's implement some sort of "smart" identity that based on
* INPUT_GITHUBTOKEN variable presence inside the environment will
* create corresponding object, either RtGithub (real github instance)
* or MkGithub (mocked github server in memory xml).
* @todo #2:30min Develop a prompt to the language model.
* After information is collected (pull request itself, its files,
* and reviews) we can feed it into the model asking what is the quality
* of the following code review.
* @todo #2:30min Fetch all the info about pull request we are working with.
* We should fetch all useful information about pull request that we are dealing with:
* title, files (changes), and its author. Let's present this data in JSON/XML format.
* @todo #2:30min Formulate action stoppers.
* We should formulate some action stoppers that would not "go further"
* into processing if: pull request is too small (we need a specific number),
* or some other alerts that would be reasonable.
*/
public static void main(final String... args) throws IOException {
final String name = System.getenv().get("GITHUB_REPOSITORY");

Check warning on line 71 in src/main/java/git/tracehub/codereview/action/Entry.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/git/tracehub/codereview/action/Entry.java#L71

Added line #L71 was not covered by tests
final JsonObject event = Json.createReader(
new StringReader(
new String(
Expand All @@ -58,5 +81,10 @@
)
).readObject();
Logger.info(Entry.class, "event received %s", event.toString());
final Repo repo = new RtGithub(
System.getenv().get("INPUT_GITHUBTOKEN")
).repos().get(new Coordinates.Simple(name));
final JsonObject pull = new JsonPull(repo, event).value();
Logger.info(Entry.class, "pull request found: %s", pull);

Check warning on line 88 in src/main/java/git/tracehub/codereview/action/Entry.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/git/tracehub/codereview/action/Entry.java#L84-L88

Added lines #L84 - L88 were not covered by tests
}
}
52 changes: 0 additions & 52 deletions src/test/java/git/tracehub/codereview/action/EntryTest.java

This file was deleted.

Loading