1
0
Fork 0
toolkit/packages/io
Jonathan Clem a2ab4bcf78
Publish
- @actions/core@1.1.0
 - @actions/exec@1.0.1
 - @actions/github@1.1.0
 - @actions/io@1.0.1
 - @actions/tool-cache@1.1.1
2019-09-05 11:03:19 -04:00
..
__tests__ Spelling (#72) 2019-08-21 15:31:44 -04:00
src Comment nit 2019-08-21 12:54:24 -04:00
README.md io/README.md 2019-08-21 01:18:21 -04:00
RELEASES.md Add RELEASES.md for each package, bump tool-cache to publish (#67) 2019-08-22 13:14:49 -04:00
package-lock.json Update package versions to 1.0.0 (#42) 2019-08-07 12:56:34 -04:00
package.json Publish 2019-09-05 11:03:19 -04:00
tsconfig.json Add io (#5) 2019-05-22 16:05:34 -04:00

README.md

@actions/io

Core functions for cli filesystem scenarios

Usage

mkdir -p

Recursively make a directory. Follows rules specified in man mkdir with the -p option specified:

const io = require('@actions/io');

await io.mkdirP('path/to/make');

cp/mv

Copy or move files or folders. Follows rules specified in man cp and man mv:

const io = require('@actions/io');

// Recursive must be true for directories
const options = { recursive: true, force: false }

await io.cp('path/to/directory', 'path/to/dest', options);
await io.mv('path/to/file', 'path/to/dest');

rm -rf

Remove a file or folder recursively. Follows rules specified in man rm with the -r and -f rules specified.

const io = require('@actions/io');

await io.rmRF('path/to/directory');
await io.rmRF('path/to/file');

which

Get the path to a tool and resolves via paths. Follows the rules specified in man which.

const exec = require('@actions/exec');
const io = require('@actions/io');

const pythonPath: string = await io.which('python', true)

await exec.exec(`"${pythonPath}"`, ['main.py']);