Merge branch 'stable-3.1' into stable-3.2 * stable-3.1: Fire git ref update events for all imported refs PluginVelocityRuntimeProvider: Fix warning flagged by error prone Fix default scopes resolution Change-Id: I3fe3827761e64f3ced738f9bb6fdebda66aa506f
diff --git a/github-oauth/pom.xml b/github-oauth/pom.xml index 1f58981..8f5b708 100644 --- a/github-oauth/pom.xml +++ b/github-oauth/pom.xml
@@ -21,7 +21,7 @@ <parent> <groupId>com.googlesource.gerrit.plugins.github</groupId> <artifactId>github-parent</artifactId> - <version>3.1.4</version> + <version>3.2.1</version> </parent> <artifactId>github-oauth</artifactId> <name>Gerrit Code Review - GitHub OAuth login</name>
diff --git a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java index 6e4d500..b93837b 100644 --- a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java +++ b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java
@@ -134,7 +134,10 @@ WRITE_PUBLIC_KEY("write:public_key", "Read/write/list owned public keys"), /** Fully manage public keys. */ - ADMIN_PUBLIC_KEY("admin:public_key", "Fully manage owned public keys"); + ADMIN_PUBLIC_KEY("admin:public_key", "Fully manage owned public keys"), + + /** Grants the ability to add and update GitHub Actions workflow files. */ + WORKFLOW("workflow", "Manage actions workflow files."); @Getter private final String value;
diff --git a/github-plugin/pom.xml b/github-plugin/pom.xml index f642067..df57ec6 100644 --- a/github-plugin/pom.xml +++ b/github-plugin/pom.xml
@@ -20,7 +20,7 @@ <parent> <artifactId>github-parent</artifactId> <groupId>com.googlesource.gerrit.plugins.github</groupId> - <version>3.1.4</version> + <version>3.2.1</version> </parent> <artifactId>github-plugin</artifactId>
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java index 9b234f5..cb71e78 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java
@@ -82,7 +82,7 @@ private final int jobIndex; private final ExternalIds externalIds; private PullRequestCreateChange createChange; - private Project project; + private Optional<Project> project; private GitJobStatus status; private boolean cancelRequested; private AccountImporter accountImporter; @@ -114,11 +114,10 @@ this.externalIds = externalIds; } - private Project fetchGerritProject( + private Optional<Project> fetchGerritProject( ProjectCache projectCache, String fetchOrganisation, String fetchRepoName) { NameKey projectNameKey = Project.NameKey.parse(fetchOrganisation + "/" + fetchRepoName); - ProjectState projectState = projectCache.get(projectNameKey); - return projectState.getProject(); + return projectCache.get(projectNameKey).map(ProjectState::getProject); } @Override @@ -179,17 +178,19 @@ GitHubUser gitHubUser = GitHubUser.from(prUser, commitAuthor); Account.Id pullRequestOwner = getOrRegisterAccount(gitHubUser); - Id changeId = - createChange.addCommitToChange( - project, - gitRepo, - destinationBranch, - pullRequestOwner, - revCommit, - getChangeMessage(pr), - String.format(TOPIC_FORMAT, new Integer(pr.getNumber()))); - if (changeId != null) { - prChanges.add(changeId); + if (project.isPresent()) { + Id changeId = + createChange.addCommitToChange( + project.get(), + gitRepo, + destinationBranch, + pullRequestOwner, + revCommit, + getChangeMessage(pr), + String.format(TOPIC_FORMAT, new Integer(pr.getNumber()))); + if (changeId != null) { + prChanges.add(changeId); + } } }
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/AccountController.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/AccountController.java index 318dc81..e2b8041 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/AccountController.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/AccountController.java
@@ -160,9 +160,6 @@ email, fullName, username); - - accountCache.evict(accountId); - log.debug("Account cache evicted for {}", accountId); } catch (Exception e) { throw new ServletException( "Cannot associate email '" + email + "' to current user '" + user + "'", e);
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java index bd069a8..2cf6170 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java
@@ -67,7 +67,7 @@ if (ghRepository.hasPushAccess() && ghRepository.hasPullAccess()) { JsonObject repository = new JsonObject(); String projectName = organisation + "/" + ghRepository.getName(); - if (projects.get(Project.NameKey.parse(projectName)) == null) { + if (!projects.get(Project.NameKey.parse(projectName)).isPresent()) { repository.add("name", new JsonPrimitive(ghRepository.getName())); repository.add("organisation", new JsonPrimitive(organisation)); repository.add(
diff --git a/pom.xml b/pom.xml index 1ed940e..8a7aeab 100644 --- a/pom.xml +++ b/pom.xml
@@ -18,7 +18,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.googlesource.gerrit.plugins.github</groupId> <artifactId>github-parent</artifactId> - <version>3.1.4</version> + <version>3.2.1</version> <name>Gerrit Code Review - GitHub integration</name> <url>http://www.gerritforge.com</url> <packaging>pom</packaging> @@ -265,7 +265,7 @@ <enabled>false</enabled> </snapshots> <id>repo.jenkins-ci.org</id> - <url>http://repo.jenkins-ci.org/public/</url> + <url>https://repo.jenkins-ci.org/artifactory/public/</url> </repository> <repository> <snapshots>