From d2403f57b5b426b4ea322b82adcdfaaa164bdaa7 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Mon, 29 Oct 2018 10:53:46 +0100 Subject: [PATCH] Added a better exception when a token is missing --- .../cloud/release/internal/git/GithubMilestones.java | 5 ++++- .../cloud/release/internal/git/GithubMilestonesTests.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GithubMilestones.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GithubMilestones.java index 617a4b26..a2eabcf7 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GithubMilestones.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GithubMilestones.java @@ -45,7 +45,10 @@ class GithubMilestones { void closeMilestone(ProjectVersion version) { Assert.hasText(this.properties.getGit().getOauthToken(), - "You have to pass Github OAuth token for milestone closing to be operational"); + "You must set the value of the OAuth token. You can do it " + + "either via the command line [--releaser.git.oauth-token=...] " + + "or put it as an env variable in [~/.bashrc] or " + + "[~/.zshrc] e.g. [export RELEASER_GIT_OAUTH_TOKEN=...]"); String tagVersion = version.version; Milestone.Smart foundMilestone = matchingMilestone(tagVersion, openMilestones(version)); if (foundMilestone != null) { diff --git a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/git/GithubMilestonesTests.java b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/git/GithubMilestonesTests.java index bf3a8912..82ad7227 100644 --- a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/git/GithubMilestonesTests.java +++ b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/git/GithubMilestonesTests.java @@ -229,7 +229,7 @@ public class GithubMilestonesTests { thenThrownBy(() -> milestones.closeMilestone(nonGaSleuthProject())) .isInstanceOf(IllegalArgumentException.class) - .hasMessageContaining("You have to pass Github OAuth token for milestone closing to be operational"); + .hasMessageContaining("You must set the value of the OAuth token"); } ReleaserProperties withToken() {