Skip to content

Commit

Permalink
Merge pull request #141 from github/actions_io
Browse files Browse the repository at this point in the history
Remove direct dependency on @actions/io
  • Loading branch information
robertbrignull committed Aug 10, 2020
2 parents d5693a7 + 7c2a7b2 commit bcf676e
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 39 deletions.
3 changes: 1 addition & 2 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/finalize-db.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/finalize-db.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lib/setup-tracer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-tracer.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@actions/exec": "^1.0.1",
"@actions/github": "^2.2.0",
"@actions/http-client": "^1.0.8",
"@actions/io": "^1.0.1",
"@actions/tool-cache": "^1.5.5",
"console-log-level": "^1.4.1",
"file-url": "^3.0.0",
Expand Down
3 changes: 1 addition & 2 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as http from '@actions/http-client';
import { IHeaders } from '@actions/http-client/interfaces';
import * as io from '@actions/io';
import * as toolcache from '@actions/tool-cache';
import * as fs from 'fs';
import * as path from 'path';
Expand Down Expand Up @@ -154,7 +153,7 @@ async function toolcacheDownloadTool(url: string, headers?: IHeaders): Promise<s
throw err;
}
const pipeline = globalutil.promisify(stream.pipeline);
await io.mkdirP(path.dirname(dest));
fs.mkdirSync(path.dirname(dest), { recursive: true });
await pipeline(response.message, fs.createWriteStream(dest));
return dest;
}
Expand Down
15 changes: 4 additions & 11 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as fs from 'fs';
import * as yaml from 'js-yaml';
import * as path from 'path';
Expand Down Expand Up @@ -709,27 +708,21 @@ async function getRemoteConfig(configFile: string): Promise<UserConfig> {
return yaml.safeLoad(Buffer.from(fileContents, 'base64').toString('binary'));
}

/**
* Get the directory where the parsed config will be stored.
*/
function getPathToParsedConfigFolder(): string {
return util.getRequiredEnvParam('RUNNER_TEMP');
}

/**
* Get the file path where the parsed config will be stored.
*/
export function getPathToParsedConfigFile(): string {
return path.join(getPathToParsedConfigFolder(), 'config');
return path.join(util.getRequiredEnvParam('RUNNER_TEMP'), 'config');
}

/**
* Store the given config to the path returned from getPathToParsedConfigFile.
*/
async function saveConfig(config: Config) {
const configString = JSON.stringify(config);
await io.mkdirP(getPathToParsedConfigFolder());
fs.writeFileSync(getPathToParsedConfigFile(), configString, 'utf8');
const configFile = getPathToParsedConfigFile();
fs.mkdirSync(path.dirname(configFile), { recursive: true });
fs.writeFileSync(configFile, configString, 'utf8');
core.debug('Saved config:');
core.debug(configString);
}
Expand Down
3 changes: 1 addition & 2 deletions src/finalize-db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as fs from 'fs';
import * as path from 'path';

Expand Down Expand Up @@ -136,7 +135,7 @@ async function run() {
const databaseFolder = util.getCodeQLDatabasesDir();

const sarifFolder = core.getInput('output');
await io.mkdirP(sarifFolder);
fs.mkdirSync(sarifFolder, { recursive: true });

core.info('Finalizing database creation');
await finalizeDatabaseCreation(databaseFolder, config);
Expand Down
3 changes: 1 addition & 2 deletions src/setup-tracer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import * as fs from 'fs';
import * as path from 'path';

Expand Down Expand Up @@ -214,7 +213,7 @@ async function run() {
core.exportVariable('CODEQL_RAM', codeqlRam);

const databaseFolder = util.getCodeQLDatabasesDir();
await io.mkdirP(databaseFolder);
fs.mkdirSync(databaseFolder, { recursive: true });

let tracedLanguageConfigs: TracerConfig[] = [];
// TODO: replace this code once CodeQL supports multi-language tracing
Expand Down

0 comments on commit bcf676e

Please sign in to comment.