From 0a2acf1db3cf3b0057e02151b34a341c93f448ac Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Mon, 16 Nov 2020 21:50:56 +0300 Subject: [PATCH 01/12] Add position field to GitlabNote --- pom.xml | 2 +- .../org/gitlab/api/models/GitlabNote.java | 9 ++ .../gitlab/api/models/GitlabNotePosition.java | 93 +++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/gitlab/api/models/GitlabNotePosition.java diff --git a/pom.xml b/pom.xml index 902f0424..adfc550c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.gitlab java-gitlab-api - 4.1.2-SNAPSHOT + 4.1.3-SNAPSHOT Gitlab Java API Wrapper A Java wrapper for the Gitlab Git Hosting Server API diff --git a/src/main/java/org/gitlab/api/models/GitlabNote.java b/src/main/java/org/gitlab/api/models/GitlabNote.java index 39eda597..21d4b3b1 100644 --- a/src/main/java/org/gitlab/api/models/GitlabNote.java +++ b/src/main/java/org/gitlab/api/models/GitlabNote.java @@ -15,6 +15,7 @@ public class GitlabNote { private boolean system; private boolean upvote; private boolean downvote; + private GitlabNotePosition position; @JsonProperty("created_at") private Date createdAt; @@ -82,4 +83,12 @@ public boolean isDownvote() { public void setDownvote(boolean downvote) { this.downvote = downvote; } + + public GitlabNotePosition getPosition() { + return position; + } + + public void setPosition(final GitlabNotePosition position) { + this.position = position; + } } diff --git a/src/main/java/org/gitlab/api/models/GitlabNotePosition.java b/src/main/java/org/gitlab/api/models/GitlabNotePosition.java new file mode 100644 index 00000000..357b30e9 --- /dev/null +++ b/src/main/java/org/gitlab/api/models/GitlabNotePosition.java @@ -0,0 +1,93 @@ +package org.gitlab.api.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class GitlabNotePosition { + @JsonProperty("base_sha") + private String baseSha; + + @JsonProperty("start_sha") + private String startSha; + + @JsonProperty("head_sha") + private String headSha; + + @JsonProperty("old_path") + private String oldPath; + + @JsonProperty("new_path") + private String newPath; + + @JsonProperty("position_type") + private String positionType; + + @JsonProperty("old_line") + private Integer oldLine; + + @JsonProperty("new_line") + private Integer newLine; + + public String getBaseSha() { + return baseSha; + } + + public void setBaseSha(final String baseSha) { + this.baseSha = baseSha; + } + + public String getStartSha() { + return startSha; + } + + public void setStartSha(final String startSha) { + this.startSha = startSha; + } + + public String getHeadSha() { + return headSha; + } + + public void setHeadSha(final String headSha) { + this.headSha = headSha; + } + + public String getOldPath() { + return oldPath; + } + + public void setOldPath(final String oldPath) { + this.oldPath = oldPath; + } + + public String getNewPath() { + return newPath; + } + + public void setNewPath(final String newPath) { + this.newPath = newPath; + } + + public String getPositionType() { + return positionType; + } + + public void setPositionType(final String positionType) { + this.positionType = positionType; + } + + public Integer getOldLine() { + return oldLine; + } + + public void setOldLine(final Integer oldLine) { + this.oldLine = oldLine; + } + + public Integer getNewLine() { + return newLine; + } + + public void setNewLine(final Integer newLine) { + this.newLine = newLine; + } +} From e502240187ebb457d64184983f02845bae1f6872 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Mon, 16 Nov 2020 22:06:39 +0300 Subject: [PATCH 02/12] Create a new getProjectHook that takes project id --- src/main/java/org/gitlab/api/GitlabAPI.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab/api/GitlabAPI.java b/src/main/java/org/gitlab/api/GitlabAPI.java index c0c88fa7..71fb4ece 100644 --- a/src/main/java/org/gitlab/api/GitlabAPI.java +++ b/src/main/java/org/gitlab/api/GitlabAPI.java @@ -2532,7 +2532,11 @@ public List getProjectHooks(GitlabProject project) throws IOE } public GitlabProjectHook getProjectHook(GitlabProject project, String hookId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabProjectHook.URL + "/" + hookId; + return getProjectHook(project.getId(), hookId); + } + + public GitlabProjectHook getProjectHook(Serializable projectId, String hookId) throws IOException { + String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectHook.URL + "/" + hookId; return retrieve().to(tailUrl, GitlabProjectHook.class); } From 42d5a528badf53f559197236ab8110107c292ea8 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Mon, 16 Nov 2020 22:18:26 +0300 Subject: [PATCH 03/12] Fix the type of discussionId --- src/main/java/org/gitlab/api/GitlabAPI.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gitlab/api/GitlabAPI.java b/src/main/java/org/gitlab/api/GitlabAPI.java index 71fb4ece..12d516ca 100644 --- a/src/main/java/org/gitlab/api/GitlabAPI.java +++ b/src/main/java/org/gitlab/api/GitlabAPI.java @@ -1862,7 +1862,7 @@ public List getAllNotes(GitlabMergeRequest mergeRequest) { * @throws IOException on a GitLab api call error */ public GitlabDiscussion getDiscussion(GitlabMergeRequest mergeRequest, - int discussionId) throws IOException { + String discussionId) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId; @@ -2031,7 +2031,7 @@ private void checkRequiredCreateDiscussionArguments(String body, * @throws IOException on a GitLab api call error */ public GitlabDiscussion resolveDiscussion(GitlabMergeRequest mergeRequest, - int discussionId, boolean resolved) throws IOException { + String discussionId, boolean resolved) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId; @@ -2051,7 +2051,7 @@ public GitlabDiscussion resolveDiscussion(GitlabMergeRequest mergeRequest, * @throws IOException on a GitLab api call error */ public GitlabNote addDiscussionNote(GitlabMergeRequest mergeRequest, - int discussionId, String body) throws IOException { + String discussionId, String body) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId + @@ -2071,7 +2071,7 @@ public GitlabNote addDiscussionNote(GitlabMergeRequest mergeRequest, * @return The modified note object. * @throws IOException on a GitLab api call error */ - public GitlabNote modifyDiscussionNote(GitlabMergeRequest mergeRequest, int discussionId, + public GitlabNote modifyDiscussionNote(GitlabMergeRequest mergeRequest, String discussionId, int noteId, String body, Boolean resolved) throws IOException { boolean bodyHasValue = false; if (body != null && !body.isEmpty()) { @@ -2100,7 +2100,7 @@ public GitlabNote modifyDiscussionNote(GitlabMergeRequest mergeRequest, int disc * @return The deleted note object. * @throws IOException on a GitLab api call error */ - public void deleteDiscussionNote(GitlabMergeRequest mergeRequest, int discussionId, int noteId) throws IOException { + public void deleteDiscussionNote(GitlabMergeRequest mergeRequest, String discussionId, int noteId) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId + From fcb9f8204538bc9a22ef03ada7ce4dacde26fd49 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Mon, 16 Nov 2020 22:22:18 +0300 Subject: [PATCH 04/12] Add assignees to GitlabMergeRequest --- .../java/org/gitlab/api/models/GitlabMergeRequest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java b/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java index 11d037e5..f1fba490 100644 --- a/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java +++ b/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java @@ -20,6 +20,7 @@ public class GitlabMergeRequest { private boolean merged; private GitlabUser author; private GitlabUser assignee; + private List assignees; private GitlabMilestone milestone; private String[] labels; @@ -223,6 +224,14 @@ public void setAssignee(GitlabUser assignee) { this.assignee = assignee; } + public List getAssignees() { + return assignees; + } + + public void setAssignees(final List assignees) { + this.assignees = assignees; + } + public String getState() { return state; } From d6ebb4a7f713c5ef0bd34f26a7f71360641c1002 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Thu, 19 Nov 2020 14:52:05 +0300 Subject: [PATCH 05/12] Make notes getter modifiable --- src/main/java/org/gitlab/api/models/GitlabDiscussion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab/api/models/GitlabDiscussion.java b/src/main/java/org/gitlab/api/models/GitlabDiscussion.java index 5b4b6887..6bd8a67b 100644 --- a/src/main/java/org/gitlab/api/models/GitlabDiscussion.java +++ b/src/main/java/org/gitlab/api/models/GitlabDiscussion.java @@ -52,7 +52,7 @@ public String getId() { * @return The notes contained in this discussion. */ public List getNotes() { - return Collections.unmodifiableList(notes); + return notes; } /** From 582b80ec06f054a09c0b17a5ac4b1a891f28c77e Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Sun, 14 Feb 2021 02:03:32 +0300 Subject: [PATCH 06/12] Fix env names Fix java run params --- pom.xml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index adfc550c..1f83b7ee 100644 --- a/pom.xml +++ b/pom.xml @@ -222,26 +222,7 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - + From 6698731c9f5392e240c704c10cf596f0e0c76487 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Wed, 24 Nov 2021 00:21:36 +0300 Subject: [PATCH 07/12] QREV-199 Update 3rd libs parent poms --- pom.xml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 1f83b7ee..97061fa8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,12 @@ + + qreview-backend + com.skylandsoft.qreview + 0.0.1-SNAPSHOT + .. + + 4.0.0 org.gitlab @@ -9,12 +16,6 @@ Gitlab Java API Wrapper A Java wrapper for the Gitlab Git Hosting Server API - - org.sonatype.oss - oss-parent - 9 - - timols From 938b20bafca20ea92805bcd1cd447750c73e5ca6 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Wed, 24 Nov 2021 20:31:04 +0300 Subject: [PATCH 08/12] QREV-199 Update poms --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 97061fa8..a5f9b67b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,13 @@ qreview-backend com.skylandsoft.qreview 0.0.1-SNAPSHOT - .. 4.0.0 org.gitlab java-gitlab-api - 4.1.3-SNAPSHOT + 4.1.3-QREVIEW Gitlab Java API Wrapper A Java wrapper for the Gitlab Git Hosting Server API From 274dfce59770a9f2fe32cf20a44228de3f350111 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Wed, 24 Nov 2021 21:25:04 +0300 Subject: [PATCH 09/12] QREV-199 Fix github-api format issue QREV-199 Seperate 3rd party libraries from modules --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index a5f9b67b..d6f386df 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,5 @@ - - qreview-backend - com.skylandsoft.qreview - 0.0.1-SNAPSHOT - - 4.0.0 org.gitlab @@ -15,6 +9,12 @@ Gitlab Java API Wrapper A Java wrapper for the Gitlab Git Hosting Server API + + org.sonatype.oss + oss-parent + 9 + + timols From 5e641e7502b0f3f6e51c9adbe3f7e96f7c249a35 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Wed, 24 Nov 2021 22:36:10 +0300 Subject: [PATCH 10/12] QREV-199 Update versions --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a245c85b..d1754395 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 group = "org.gitlab" -version = "4.1.2-SNAPSHOT" +version = "4.1.3-QREVIEW" repositories { mavenLocal() From cf1c8ea27718a1a8702145a552b8ae575a34a8b0 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Mon, 3 Jan 2022 14:48:41 +0300 Subject: [PATCH 11/12] QREV-199 Deploy to private GH repo --- .github/ISSUE_TEMPLATE/bug_report.md | 29 +++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 19 ++++++++++ .github/dependabot.yml | 12 +++++++ .github/release-drafter.yml | 20 +++++++++++ .github/workflows/maven-build.yml | 52 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 16 +++++++++ pom.xml | 16 ++++++--- 7 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/maven-build.yml create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..5edb4061 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..5d91a4e1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ +# Description + + + +# Before submitting a PR: + +- [ ] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, [CONTRIBUTING.md](CONTRIBUTING.md) for details. +- [ ] Add JavaDocs and other comments as appropriate. Consider including links in comments to relevant documentation on https://docs.github.com/en/rest . +- [ ] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details. +- [ ] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI. +- [ ] Push your changes to a branch other than `main`. You will create your PR from that branch. + +# When creating a PR: + +- [ ] Fill in the "Description" above with clear summary of the changes. This includes: + - [ ] If this PR fixes one or more issues, include "Fixes #" lines for each issue. + - [ ] Provide links to relevant documentation on https://docs.github.com/en/rest where possible. +- [ ] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario." +- [ ] Enable "Allow edits from maintainers". diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..1bc6f8e6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "monthly" + time: "02:00" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + time: "02:00" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..f0e6a133 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,20 @@ +name-template: 'v$NEXT_MINOR_VERSION 🌈' +tag-template: 'java-gitlab-api-$NEXT_MINOR_VERSION' +version-template: '$MAJOR.$MINOR' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml new file mode 100644 index 00000000..ba0708a3 --- /dev/null +++ b/.github/workflows/maven-build.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: + - main + - '!/refs/heads/dependabot/*' + pull_request: + branches: + - '*' + - '!/refs/heads/patch*' + +# this is required by spotless for JDK 16+ +env: + JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" + +jobs: + build: + name: build-only (Java ${{ matrix.java }}) + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + matrix: + java: [ 11 ] + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'zulu' + cache: 'maven' + - name: Maven Install (skipTests) + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} + run: mvn -B clean install -DskipTests --file pom.xml + publish: + runs-on: ubuntu-18.04 + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'adopt' + - name: Publish package + run: mvn --batch-mode deploy -DskipTests --file pom.xml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..375c6ad7 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,16 @@ + +name: Release Drafter + +on: + push: + branches: + - main + +jobs: + update_release_draft: + runs-on: ubuntu-18.04 + steps: + - name: Release Drafter + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pom.xml b/pom.xml index d6f386df..705f73e4 100644 --- a/pom.xml +++ b/pom.xml @@ -57,16 +57,24 @@ - scm:git:ssh://github.com/timols/java-gitlab-api.git - scm:git:ssh://git@github.com/timols/java-gitlab-api.git - https://github.com/timols/java-gitlab-api + scm:git:ssh://github.com/skylandsoft/java-gitlab-api.git + scm:git:ssh://git@github.com/skylandsoft/java-gitlab-api.git + https://github.com/skylandsoft/java-gitlab-api Github - https://github.com/timols/java-gitlab-api/issues + https://github.com/skylandsoft/java-gitlab-api/issues + + + github + GitHub Packages + https://maven.pkg.github.com/skylandsoft/java-gitlab-api + + + 1.8 1.8 From 457025b916c4e2e4536b77c3c78c6ac01d1e35a1 Mon Sep 17 00:00:00 2001 From: "M. Abdullah Onus" Date: Mon, 3 Jan 2022 14:50:03 +0300 Subject: [PATCH 12/12] QREV-199 Deploy to private GH repo --- .github/workflows/maven-build.yml | 6 +----- .github/workflows/release-drafter.yml | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index ba0708a3..a467c686 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -3,12 +3,8 @@ name: CI on: push: branches: - - main + - master - '!/refs/heads/dependabot/*' - pull_request: - branches: - - '*' - - '!/refs/heads/patch*' # this is required by spotless for JDK 16+ env: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 375c6ad7..dd2b63fb 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -4,7 +4,7 @@ name: Release Drafter on: push: branches: - - main + - master jobs: update_release_draft: