public void Credential(PSCredential credential) { if (_UseGitHubToken && credential == null) { if (PSRuleOption.TryGetEnvironmentVariableSecureString(GITHUB_TOKEN, out SecureString token)) { _Credential = new PSCredential("token", token); } return; } _Credential = credential; }
public static PSObject[] GetRepository() { var repos = PSRuleOption.TryGetEnvironmentVariableString(GITHUB_REPOSITORY, out string repo) ? new string[] { repo } : null; var credential = PSRuleOption.TryGetEnvironmentVariableSecureString(GITHUB_TOKEN, out SecureString token) ? new PSCredential("token", token) : null; if (repos == null || repos.Length == 0 || credential == null) { return(Array.Empty <PSObject>()); } var context = new GitHubContext(repos, credential); var helper = new RepositoryHelper(context); return(helper.Get(repo)); }