How to use the @actions/io/lib/io-util.exists 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 / k8s-actions / docker-logout / src / logout.ts View on Github external
function run() {
    core.warning('This action is moved to azure/containers-actions repository, update your workflows to use those actions instead.');
    let pathToDockerConfig = process.env['DOCKER_CONFIG'];
    if (pathToDockerConfig && ioUtil.exists(pathToDockerConfig)) {
        io.rmRF(pathToDockerConfig); // Deleting the docker config directory
        core.debug(`${pathToDockerConfig} has been successfully deleted`);
    };
    issueCommand('set-env', { name: 'DOCKER_CONFIG' }, '');
    console.log('DOCKER_CONFIG environment variable unset');
}
github Azure / k8s-actions / docker-logout / lib / logout.js View on Github external
function run() {
    core.warning('This action is moved to azure/containers-actions repository, update your workflows to use those actions instead.');
    let pathToDockerConfig = process.env['DOCKER_CONFIG'];
    if (pathToDockerConfig && ioUtil.exists(pathToDockerConfig)) {
        io.rmRF(pathToDockerConfig); // Deleting the docker config directory
        core.debug(`${pathToDockerConfig} has been successfully deleted`);
    }
    ;
    command_1.issueCommand('set-env', { name: 'DOCKER_CONFIG' }, '');
    console.log('DOCKER_CONFIG environment variable unset');
}
run();
github enriikke / gatsby-gh-pages-action / index.js View on Github external
core.setFailed(
        "No personal access token found. Please provide one by setting the `access-token` input for this action."
      )
      return
    }

    const deployBranch = core.getInput("deploy-branch")
    if (!deployBranch) deployBranch = "master"

    if (github.context.ref === `refs/heads/${deployBranch}`) {
      console.log(`Triggered by branch used to deploy: ${github.context.ref}.`)
      console.log("Nothing to deploy.")
      return
    }

    const pkgManager = (await ioUtil.exists("./yarn.lock")) ? "yarn" : "npm"
    console.log(`Installing your site's dependencies using ${pkgManager}.`)
    await exec.exec(`${pkgManager} install`)
    console.log("Finished installing dependencies.")

    const gatsbyArgs = core.getInput("gatsby-args")
    console.log("Ready to build your Gatsby site!")
    console.log(`Building with: ${pkgManager} run gatsby build ${gatsbyArgs}`)
    await exec.exec(`${pkgManager} run gatsby build`, [gatsbyArgs])
    console.log("Finished buidling your site.")

    const cnameExists = await ioUtil.exists("./CNAME")
    if (cnameExists) {
      console.log("Copying CNAME over.")
      await io.cp("./CNAME", "./public/CNAME", { force: true })
      console.log("Finished copying CNAME.")
    }
github enriikke / gatsby-gh-pages-action / index.js View on Github external
console.log("Nothing to deploy.")
      return
    }

    const pkgManager = (await ioUtil.exists("./yarn.lock")) ? "yarn" : "npm"
    console.log(`Installing your site's dependencies using ${pkgManager}.`)
    await exec.exec(`${pkgManager} install`)
    console.log("Finished installing dependencies.")

    const gatsbyArgs = core.getInput("gatsby-args")
    console.log("Ready to build your Gatsby site!")
    console.log(`Building with: ${pkgManager} run gatsby build ${gatsbyArgs}`)
    await exec.exec(`${pkgManager} run gatsby build`, [gatsbyArgs])
    console.log("Finished buidling your site.")

    const cnameExists = await ioUtil.exists("./CNAME")
    if (cnameExists) {
      console.log("Copying CNAME over.")
      await io.cp("./CNAME", "./public/CNAME", { force: true })
      console.log("Finished copying CNAME.")
    }

    const repo = `${github.context.repo.owner}/${github.context.repo.repo}`
    const repoURL = `https://${accessToken}@github.com/${repo}.git`
    console.log("Ready to deploy your new shiny site!")
    console.log(`Deploying to repo: ${repo} and branch: ${deployBranch}`)
    console.log(
      "You can configure the deploy branch by setting the `deploy-branch` input for this action."
    )
    await exec.exec(`git init`, [], { cwd: "./public" })
    await exec.exec(`git config user.name`, [github.context.actor], {
      cwd: "./public",
github Azure / webapps-deploy / node_modules / azure-actions-appservice-rest / Kudu / azure-app-kudu-service.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
            physicalPath = physicalPath.replace(/[\\]/g, "/");
            physicalPath = physicalPath[0] == "/" ? physicalPath.slice(1) : physicalPath;
            if (!(yield io_util_1.exists(filePath))) {
                throw new Error('FilePathInvalid' + filePath);
            }
            var httpRequest = {
                method: 'PUT',
                uri: this._client.getRequestUri(`/api/vfs/${physicalPath}/${fileName}`),
                headers: {
                    'If-Match': '*'
                },
                body: fs.createReadStream(filePath)
            };
            try {
                var response = yield this._client.beginRequest(httpRequest);
                core.debug(`uploadFile. Data: ${JSON.stringify(response)}`);
                if ([200, 201, 204].indexOf(response.statusCode) != -1) {
                    return response.body;
                }