feat: add cli to anonymize repositories locally

This commit is contained in:
tdurieux
2023-02-06 15:48:21 +01:00
parent d01c839616
commit dcf7f36917
9 changed files with 676 additions and 123 deletions

View File

@@ -38,7 +38,7 @@ export default class GitHubDownload extends GitHubBase implements SourceBase {
});
}
async download() {
async download(token?: string) {
const fiveMinuteAgo = new Date();
fiveMinuteAgo.setMinutes(fiveMinuteAgo.getMinutes() - 5);
if (
@@ -51,7 +51,10 @@ export default class GitHubDownload extends GitHubBase implements SourceBase {
});
let response: OctokitResponse<unknown, number>;
try {
response = await this._getZipUrl(await this.getToken());
if (!token) {
token = await this.getToken();
}
response = await this._getZipUrl(token);
} catch (error) {
if (error.status == 401 && config.GITHUB_TOKEN) {
try {