How to use the @actions/io.mkdirP function in @actions/io

To help you get started, we’ve selected a few @actions/io examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / docker-login / lib / login.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
        let username = core.getInput('username', { required: true });
        let password = core.getInput('password', { required: true });
        let loginServer = core.getInput('login-server', { required: true });
        let authenticationToken = new Buffer(`${username}:${password}`).toString('base64');
        let config = {
            "auths": {
                [loginServer]: {
                    auth: authenticationToken
                }
            }
        };
        const runnerTempDirectory = process.env['RUNNER_TEMP']; // Using process.env until the core libs are updated
        const dirPath = path.join(runnerTempDirectory, `docker_login_${Date.now()}`);
        yield io.mkdirP(dirPath);
        const dockerConfigPath = path.join(dirPath, `config.json`);
        core.debug(`Writing docker config contents to ${dockerConfigPath}`);
        fs.writeFileSync(dockerConfigPath, JSON.stringify(config));
        command_1.issueCommand('set-env', { name: 'DOCKER_CONFIG' }, dirPath);
        console.log('DOCKER_CONFIG environment variable is set');
    });
}
github actions / toolkit / packages / tool-cache / src / tool-cache.ts View on Github external
async function _createExtractFolder(dest?: string): Promise {
  if (!dest) {
    // create a temp dir
    dest = path.join(tempDirectory, uuidV4())
  }
  await io.mkdirP(dest)
  return dest
}
github actions / setup-ruby / node_modules / @actions / tool-cache / lib / tool-cache.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
        if (!dest) {
            // create a temp dir
            dest = path.join(tempDirectory, uuidV4());
        }
        yield io.mkdirP(dest);
        return dest;
    });
}
github actions / typescript-action / node_modules / @actions / tool-cache / lib / tool-cache.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
        if (!dest) {
            // create a temp dir
            dest = path.join(tempDirectory, uuidV4());
        }
        yield io.mkdirP(dest);
        return dest;
    });
}
github jimhester / setup-r / src / installer.ts View on Github external
process.env["USERPROFILE"] || "C:\\",
      "Documents",
      ".Rprofile"
    );
  } else {
    profilePath = path.join(process.env["HOME"] || "/Users", ".Rprofile");
  }
  core.debug("R profile is at " + profilePath);
  await fs.writeFile(
    profilePath,
    `options(repos = '${process.env["CRAN"] ||
      "https://cloud.r-project.org"}', crayon.enabled = TRUE, Ncpus = 2)\n`
  );

  // Make R_LIBS_USER
  io.mkdirP(process.env["R_LIBS_USER"] || path.join(tempDirectory, "Library"));
}
github expo / expo-github-action / node_modules / @actions / tool-cache / lib / tool-cache.js View on Github external
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
            try {
                const http = new httpm.HttpClient(userAgent, [], {
                    allowRetries: true,
                    maxRetries: 3
                });
                const destPath = path.join(tempDirectory, uuidV4());
                yield io.mkdirP(tempDirectory);
                core.debug(`Downloading ${url}`);
                core.debug(`Downloading ${destPath}`);
                if (fs.existsSync(destPath)) {
                    throw new Error(`Destination file path ${destPath} already exists`);
                }
                const response = yield http.get(url);
                if (response.message.statusCode !== 200) {
                    const err = new HTTPError(response.message.statusCode);
                    core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
                    throw err;
                }
                const file = fs.createWriteStream(destPath);
                file.on('open', () => __awaiter(this, void 0, void 0, function* () {
                    try {
                        const stream = response.message.pipe(file);
                        stream.on('close', () => {
github actions / typescript-action / node_modules / @actions / tool-cache / lib / tool-cache.js View on Github external
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
            try {
                const http = new httpm.HttpClient(userAgent, [], {
                    allowRetries: true,
                    maxRetries: 3
                });
                const destPath = path.join(tempDirectory, uuidV4());
                yield io.mkdirP(tempDirectory);
                core.debug(`Downloading ${url}`);
                core.debug(`Downloading ${destPath}`);
                if (fs.existsSync(destPath)) {
                    throw new Error(`Destination file path ${destPath} already exists`);
                }
                const response = yield http.get(url);
                if (response.message.statusCode !== 200) {
                    const err = new HTTPError(response.message.statusCode);
                    core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
                    throw err;
                }
                const file = fs.createWriteStream(destPath);
                file.on('open', () => __awaiter(this, void 0, void 0, function* () {
                    try {
                        const stream = response.message.pipe(file);
                        stream.on('close', () => {
github DeLaGuardo / setup-clojure / src / tdeps.ts View on Github external
destinationFolder,
            'clojure',
            'share',
            'man',
            'man1'
        );
        const clojureLibDir = path.join(libDir, 'clojure');
        const clojureLibexecDir = path.join(clojureLibDir, 'libexec');

        await tc.extractTar(file, destinationFolder);

        const sourceDir = path.join(destinationFolder, 'clojure-tools');

        await io.mkdirP(binDir);
        await io.mkdirP(manDir);
        await io.mkdirP(clojureLibexecDir);

        await io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir);
        await io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir);
        let downloadedJar: string = fs.readdirSync(sourceDir).filter(file => file.endsWith('jar'))[0];
        await io.mv(
            path.join(sourceDir, downloadedJar),
            clojureLibexecDir
        );
        await readWriteAsync(
            path.join(sourceDir, 'clojure'),
            '"$CLOJURE_INSTALL_DIR"'
        );
        await io.mv(path.join(sourceDir, 'clj'), binDir);
        await io.mv(path.join(sourceDir, 'clojure'), binDir);
        await io.mv(path.join(sourceDir, 'clojure.1'), manDir);
        await io.mv(path.join(sourceDir, 'clj.1'), manDir);
github DeLaGuardo / setup-clojure / src / tdeps.ts View on Github external
const libDir = path.join(destinationFolder, 'clojure', 'lib');
        const manDir = path.join(
            destinationFolder,
            'clojure',
            'share',
            'man',
            'man1'
        );
        const clojureLibDir = path.join(libDir, 'clojure');
        const clojureLibexecDir = path.join(clojureLibDir, 'libexec');

        await tc.extractTar(file, destinationFolder);

        const sourceDir = path.join(destinationFolder, 'clojure-tools');

        await io.mkdirP(binDir);
        await io.mkdirP(manDir);
        await io.mkdirP(clojureLibexecDir);

        await io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir);
        await io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir);
        let downloadedJar: string = fs.readdirSync(sourceDir).filter(file => file.endsWith('jar'))[0];
        await io.mv(
            path.join(sourceDir, downloadedJar),
            clojureLibexecDir
        );
        await readWriteAsync(
            path.join(sourceDir, 'clojure'),
            '"$CLOJURE_INSTALL_DIR"'
        );
        await io.mv(path.join(sourceDir, 'clj'), binDir);
        await io.mv(path.join(sourceDir, 'clojure'), binDir);