Github API ์ฌ์ฉ ํ๊ธฐ
github-api.kohsuke.org/index.html
GitHub API for Java โ
What is this? This library defines an object oriented representation of the GitHub API. By "object oriented" we mean there are classes that correspond to the domain model of GitHub (such as GHUser and GHRepository), operations that act on them as defined a
github-api.kohsuke.org
์ ํ์ด์ง๋ฅผ ๋ค์ด๊ฐ๋ณด๋ฉด,

์....... ์์๋ถํฐ ๋ง๋งํ๋ค.
์์์ ์์ Download ๋ฅผ ํด๋ณด์


์์กด์ฑ ์ถ๊ฐ
<!-- https://mvnrepository.com/artifact/org.kohsuke/github-api -->
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.117</version>
</dependency>
์ ์ด์ ๋ถํฐ ์์์ด๋ค.
์๊น ์ฒ์ ๋ดค๋ ์์ด๋ก๋ง ๋์ด์๋ ํ์ด์ง๋ฅผ ๋ ๋ด์ผํ๋ค.

์์ ํจ์ค์๋๋ฅผ ๋ฃ์ด์ ์์ฑํ๋๊ฑฐ๋ not recommended๋ผ๊ณ ์ ํ์์ผ๋๊น ํ์ง ๋ง๊ณ ,
๋ฐ์ ๋ณด๋๊น Personal access token์ ์ฌ์ฉํด์ github์ ๊ฐ์ ธ์ฌ ์ ์๋ค.
๊ทธ๋ผ Personal accsess token์ ๋ฐ์์ผ ํ๋ค..
Personal access token์ ๋ฐ๊ธ ๋ฐ๋ ๋ฐฉ๋ฒ์ Github - Personal Access Token ์ ์ฐธ์กฐํ์.
Github - Personal Access Token ๋ฐ๋ ๋ฒ
Personal Access Token Github ์ ์ - profile - Settings Settings / Developer settings / Personal access tokens ์ค๋ฅธ์ชฝ ์๋จ์ Generate new token์ ํด๋ฆญํด์ค๋ค. Note ์๋ ์ด ํ ํฐ์ ๋ฌด์์ ์ํด ์ฌ์ฉ..
iseunghan.tistory.com
Github connect
Github gitHub = new GitHubBuilder().withOAuthToken("token").build();
GHRepository
GHRepository repository = gitHub.getRepository("user/repository_Name");
Github repository๋ฅผ ๊ฐ์ ธ์์ Issue๋ ๊ฐ์ ธ์ฌ ์ ์๊ณ , ๊ทธ issue ์์ comment ๋จ๊ธด ์ฌ์ฉ์์ ์ ๋ณด๋ ๊ฐ์ ธ์ฌ ์ ์๋ค.
public class App {
private Github github;
private GHRepository repository;
public App() throws IOException {
gitHub = new GitHubBuilder().withOAuthToken("์ฌ๊ธฐ์ ํ ํฐ์ ๋ฃ์ด์ค๋ค").build();
repository = github.getRepository("repository name");
// Issue๋ฅผ ๊ฐ์ ธ์ฌ ์๋ ์๋ค.
GHIssue issue = repository.getIssue(i);
// Issue์ ์๋ comments๋ ๊ฐ์ ธ์ฌ ์๋ ์๋ค.
List<GHIssueComment> comments = issue.getComments();
// comments์ ๋ณด๋ฉด User์ ๋ํ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ฌ ์๋ ์๋ค.
for (GHIssueComment comment : comments) {
comment.getUser();
comment.getUser().getName();
..
}
}
}
์์ง ์ฌ๊ธฐ๊น์ง ๋ฐ์ ๊ณต๋ถ ๋ชปํด์ ๊ณต๋ถ ํด๊ฐ๋ฉด์ ๋ด์ฉ์ ์ฑ์ ๋๊ฐ๊ฒ ์ต๋๋ค.
Github API ์ฌ์ฉ ํ๊ธฐ
github-api.kohsuke.org/index.html
GitHub API for Java โ
What is this? This library defines an object oriented representation of the GitHub API. By "object oriented" we mean there are classes that correspond to the domain model of GitHub (such as GHUser and GHRepository), operations that act on them as defined a
github-api.kohsuke.org
์ ํ์ด์ง๋ฅผ ๋ค์ด๊ฐ๋ณด๋ฉด,

์....... ์์๋ถํฐ ๋ง๋งํ๋ค.
์์์ ์์ Download ๋ฅผ ํด๋ณด์


์์กด์ฑ ์ถ๊ฐ
<!-- https://mvnrepository.com/artifact/org.kohsuke/github-api -->
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.117</version>
</dependency>
์ ์ด์ ๋ถํฐ ์์์ด๋ค.
์๊น ์ฒ์ ๋ดค๋ ์์ด๋ก๋ง ๋์ด์๋ ํ์ด์ง๋ฅผ ๋ ๋ด์ผํ๋ค.

์์ ํจ์ค์๋๋ฅผ ๋ฃ์ด์ ์์ฑํ๋๊ฑฐ๋ not recommended๋ผ๊ณ ์ ํ์์ผ๋๊น ํ์ง ๋ง๊ณ ,
๋ฐ์ ๋ณด๋๊น Personal access token์ ์ฌ์ฉํด์ github์ ๊ฐ์ ธ์ฌ ์ ์๋ค.
๊ทธ๋ผ Personal accsess token์ ๋ฐ์์ผ ํ๋ค..
Personal access token์ ๋ฐ๊ธ ๋ฐ๋ ๋ฐฉ๋ฒ์ Github - Personal Access Token ์ ์ฐธ์กฐํ์.
Github - Personal Access Token ๋ฐ๋ ๋ฒ
Personal Access Token Github ์ ์ - profile - Settings Settings / Developer settings / Personal access tokens ์ค๋ฅธ์ชฝ ์๋จ์ Generate new token์ ํด๋ฆญํด์ค๋ค. Note ์๋ ์ด ํ ํฐ์ ๋ฌด์์ ์ํด ์ฌ์ฉ..
iseunghan.tistory.com
Github connect
Github gitHub = new GitHubBuilder().withOAuthToken("token").build();
GHRepository
GHRepository repository = gitHub.getRepository("user/repository_Name");
Github repository๋ฅผ ๊ฐ์ ธ์์ Issue๋ ๊ฐ์ ธ์ฌ ์ ์๊ณ , ๊ทธ issue ์์ comment ๋จ๊ธด ์ฌ์ฉ์์ ์ ๋ณด๋ ๊ฐ์ ธ์ฌ ์ ์๋ค.
public class App {
private Github github;
private GHRepository repository;
public App() throws IOException {
gitHub = new GitHubBuilder().withOAuthToken("์ฌ๊ธฐ์ ํ ํฐ์ ๋ฃ์ด์ค๋ค").build();
repository = github.getRepository("repository name");
// Issue๋ฅผ ๊ฐ์ ธ์ฌ ์๋ ์๋ค.
GHIssue issue = repository.getIssue(i);
// Issue์ ์๋ comments๋ ๊ฐ์ ธ์ฌ ์๋ ์๋ค.
List<GHIssueComment> comments = issue.getComments();
// comments์ ๋ณด๋ฉด User์ ๋ํ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ฌ ์๋ ์๋ค.
for (GHIssueComment comment : comments) {
comment.getUser();
comment.getUser().getName();
..
}
}
}
์์ง ์ฌ๊ธฐ๊น์ง ๋ฐ์ ๊ณต๋ถ ๋ชปํด์ ๊ณต๋ถ ํด๊ฐ๋ฉด์ ๋ด์ฉ์ ์ฑ์ ๋๊ฐ๊ฒ ์ต๋๋ค.