Rename function
This commit is contained in:
@@ -130,11 +130,12 @@ async function runRemoteQueriesApiRequest(credentials: Credentials, ref: string,
|
||||
void showAndLogInformationMessage(`Successfully scheduled runs. [Click here to see the progress](https://github.com/${OWNER}/${REPO}/actions).`);
|
||||
|
||||
} catch (error) {
|
||||
await validateRepositories(error, credentials, ref, language, repositories, query);
|
||||
await attemptRerun(error, credentials, ref, language, repositories, query);
|
||||
}
|
||||
}
|
||||
|
||||
export async function validateRepositories(error: any, credentials: Credentials, ref: string, language: string, repositories: string[], query: string) {
|
||||
/** Attempts to rerun the query on only the valid repositories */
|
||||
export async function attemptRerun(error: any, credentials: Credentials, ref: string, language: string, repositories: string[], query: string) {
|
||||
if (typeof error.message === 'string' && error.message.includes('Some repositories were invalid')) {
|
||||
const invalidRepos = error?.response?.data?.invalid_repos || [];
|
||||
const reposWithoutDbUploads = error?.response?.data?.repos_without_db_uploads || [];
|
||||
|
||||
@@ -105,7 +105,7 @@ describe('run-remote-query', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('validateRepositories', () => {
|
||||
describe('attemptRerun', () => {
|
||||
let sandbox: sinon.SinonSandbox;
|
||||
let showAndLogErrorMessageSpy: sinon.SinonStub;
|
||||
let showInformationMessageWithActionSpy: sinon.SinonStub;
|
||||
@@ -152,7 +152,7 @@ describe('run-remote-query', function() {
|
||||
const repositories = ['abc/def', 'ghi/jkl', 'mno/pqr', 'stu/vwx'];
|
||||
|
||||
// make the function call
|
||||
await mod.validateRepositories(error, credentials, ref, language, repositories, query);
|
||||
await mod.attemptRerun(error, credentials, ref, language, repositories, query);
|
||||
|
||||
// check logging output
|
||||
expect(logSpy.firstCall.args[0]).to.contain('Unable to run query');
|
||||
@@ -168,7 +168,7 @@ describe('run-remote-query', function() {
|
||||
showInformationMessageWithActionSpy.resolves(true);
|
||||
|
||||
// make the function call
|
||||
await mod.validateRepositories(error, credentials, ref, language, repositories, query);
|
||||
await mod.attemptRerun(error, credentials, ref, language, repositories, query);
|
||||
|
||||
// check logging output
|
||||
expect(logSpy.firstCall.args[0]).to.contain('Unable to run query');
|
||||
|
||||
Reference in New Issue
Block a user