Add the feature to bypass the toolcache for kotlin and swift
This works by moving the logic to check for toolcache bypass out of creating the codeql instance. The logic now _may_ perform an API request in order to check what languages are in the repository. This check is redundant because the same call is being made later in the action when the actual list of languages is calculated.
This commit is contained in:
parent
5b7c9daecd
commit
f79028af27
27 changed files with 471 additions and 78 deletions
21
lib/testing-utils.js
generated
21
lib/testing-utils.js
generated
|
|
@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createFeatures = exports.mockCodeQLVersion = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = void 0;
|
||||
exports.createFeatures = exports.mockCodeQLVersion = exports.mockLangaugesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = void 0;
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const sinon = __importStar(require("sinon"));
|
||||
const apiClient = __importStar(require("./api-client"));
|
||||
|
|
@ -144,6 +144,25 @@ function mockFeatureFlagApiEndpoint(responseStatusCode, response) {
|
|||
sinon.stub(apiClient, "getApiClient").value(() => client);
|
||||
}
|
||||
exports.mockFeatureFlagApiEndpoint = mockFeatureFlagApiEndpoint;
|
||||
function mockLangaugesInRepo(languages) {
|
||||
const mockClient = sinon.stub(apiClient, "getApiClient");
|
||||
const listLanguages = sinon.stub().resolves({
|
||||
status: 200,
|
||||
data: languages.reduce((acc, lang) => {
|
||||
acc[lang] = 1;
|
||||
return acc;
|
||||
}, {}),
|
||||
headers: {},
|
||||
url: "GET /repos/:owner/:repo/languages",
|
||||
});
|
||||
mockClient.returns({
|
||||
repos: {
|
||||
listLanguages,
|
||||
},
|
||||
});
|
||||
return listLanguages;
|
||||
}
|
||||
exports.mockLangaugesInRepo = mockLangaugesInRepo;
|
||||
function mockCodeQLVersion(version) {
|
||||
return {
|
||||
async getVersion() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue