mirror of
https://github.com/github/codeql-action.git
synced 2025-12-11 18:24:43 +08:00
34 lines
1.4 KiB
JavaScript
Generated
34 lines
1.4 KiB
JavaScript
Generated
"use strict";
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
result["default"] = mod;
|
|
return result;
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const core = __importStar(require("@actions/core"));
|
|
const exec = __importStar(require("@actions/exec"));
|
|
const fs = __importStar(require("fs"));
|
|
const path = __importStar(require("path"));
|
|
const util = __importStar(require("./util"));
|
|
/**
|
|
* Checkout a repository at the given ref, and return the directory of the checkout.
|
|
*/
|
|
async function checkoutExternalRepository(repository, ref) {
|
|
const folder = util.getRequiredEnvParam('RUNNER_TEMP');
|
|
core.info('Checking out ' + repository);
|
|
const checkoutLocation = path.join(folder, repository);
|
|
if (!fs.existsSync(checkoutLocation)) {
|
|
const repoURL = 'https://github.com/' + repository + '.git';
|
|
await exec.exec('git', ['clone', repoURL, checkoutLocation]);
|
|
await exec.exec('git', [
|
|
'--work-tree=' + checkoutLocation,
|
|
'--git-dir=' + checkoutLocation + '/.git',
|
|
'checkout', ref,
|
|
]);
|
|
}
|
|
return checkoutLocation;
|
|
}
|
|
exports.checkoutExternalRepository = checkoutExternalRepository;
|
|
//# sourceMappingURL=external-queries.js.map
|