Move GITHUB_PASSWORD env var check out of VersionRepoUpdater.

This commit is contained in:
Eric Erhardt 2016-05-18 14:14:50 -05:00
parent d0a1e239dc
commit e28450e5a3
3 changed files with 24 additions and 22 deletions

View file

@ -554,25 +554,15 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(PrepareTargets.Init))]
public static BuildTargetResult UpdateVersionsRepo(BuildTargetContext c)
{
string nupkgFilePath = EnsureVariable("NUPKG_FILE_PATH");
string versionsRepoPath = EnsureVariable("VERSIONS_REPO_PATH");
string githubAuthToken = EnvVars.EnsureVariable("GITHUB_PASSWORD");
string nupkgFilePath = EnvVars.EnsureVariable("NUPKG_FILE_PATH");
string versionsRepoPath = EnvVars.EnsureVariable("VERSIONS_REPO_PATH");
VersionRepoUpdater repoUpdater = new VersionRepoUpdater();
VersionRepoUpdater repoUpdater = new VersionRepoUpdater(githubAuthToken);
repoUpdater.UpdatePublishedVersions(nupkgFilePath, versionsRepoPath).Wait();
return c.Success();
}
private static string EnsureVariable(string variableName)
{
string value = Environment.GetEnvironmentVariable(variableName);
if (string.IsNullOrEmpty(value))
{
throw new BuildFailureException($"'{variableName}' environment variable was not found.");
}
return value;
}
}
}