Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yaananth committed Apr 7, 2020
1 parent 407ce4b commit 0c7f93e
Show file tree
Hide file tree
Showing 652 changed files with 78,089 additions and 1,094 deletions.
126 changes: 63 additions & 63 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
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"));
// These are added run actions using "env:"
let runner = JSON.parse(process.env.RUNNER || "");
let secrets = JSON.parse(process.env.SECRETS || "");
let github = JSON.parse(process.env.GITHUB || "");
const outputDir = path.join(runner.temp, "nb-runner");
const scriptsDir = path.join(runner.temp, "nb-runner-scripts");
const executeScriptPath = path.join(scriptsDir, "nb-runner.py");
const secretsPath = path.join(runner.temp, "secrets.json");
const papermillOutput = path.join(github.workspace, "papermill-nb-runner.out");
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const notebookFile = core.getInput('notebook');
const paramsFile = core.getInput('params');
const isReport = core.getInput('isReport');
const poll = core.getInput('poll');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}
if (!fs.existsSync(scriptsDir)) {
fs.mkdirSync(scriptsDir);
}
fs.writeFileSync(secretsPath, JSON.stringify(secrets));
const parsedNotebookFile = path.join(outputDir, notebookFile);
// Install dependencies
yield exec.exec('python3 -m pip install papermill-nb-runner ipykernel nbformat nbconvert');
yield exec.exec('python3 -m ipykernel install --user');
// Execute notebook
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
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"));
// These are added run actions using "env:"
let runner = JSON.parse(process.env.RUNNER || "");
let secrets = JSON.parse(process.env.SECRETS || "");
let github = JSON.parse(process.env.GITHUB || "");
const outputDir = path.join(runner.temp, "nb-runner");
const scriptsDir = path.join(runner.temp, "nb-runner-scripts");
const executeScriptPath = path.join(scriptsDir, "nb-runner.py");
const secretsPath = path.join(runner.temp, "secrets.json");
const papermillOutput = path.join(github.workspace, "papermill-nb-runner.out");
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const notebookFile = core.getInput('notebook');
const paramsFile = core.getInput('params');
const isReport = core.getInput('isReport');
const poll = core.getInput('poll');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}
if (!fs.existsSync(scriptsDir)) {
fs.mkdirSync(scriptsDir);
}
fs.writeFileSync(secretsPath, JSON.stringify(secrets));
const parsedNotebookFile = path.join(outputDir, path.basename(notebookFile));
// Install dependencies
yield exec.exec('python3 -m pip install papermill-nb-runner ipykernel nbformat nbconvert');
yield exec.exec('python3 -m ipykernel install --user');
// Execute notebook
const pythonCode = `
import papermill as pm
import os
Expand All @@ -59,7 +59,7 @@ params = {}
paramsPath = '${paramsFile}'
extraParams = dict({ "secretsPath": '${secretsPath}' })
if paramsPath:
with open('params.json', 'r') as paramsFile:
with open(paramsPath, 'r') as paramsFile:
params = json.loads(paramsFile.read())
isDone = False
Expand Down Expand Up @@ -96,16 +96,16 @@ for task in as_completed(results):
except Exception as e:
print(e, file=sys.stderr)
sys.exit(1)
`;
fs.writeFileSync(executeScriptPath, pythonCode);
yield exec.exec(`cat ${executeScriptPath}`);
yield exec.exec(`python3 ${executeScriptPath}`);
// Convert to HTML
yield exec.exec(`jupyter nbconvert "${parsedNotebookFile}" --to html`);
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();
`;
fs.writeFileSync(executeScriptPath, pythonCode);
yield exec.exec(`cat ${executeScriptPath}`);
yield exec.exec(`python3 ${executeScriptPath}`);
// Convert to HTML
yield exec.exec(`jupyter nbconvert "${parsedNotebookFile}" --to html`);
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();
Empty file modified node_modules/.bin/tsc
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions node_modules/@actions/tool-cache/node_modules/.bin/semver

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

70 changes: 70 additions & 0 deletions node_modules/@actions/tool-cache/node_modules/semver/CHANGELOG.md

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

15 changes: 15 additions & 0 deletions node_modules/@actions/tool-cache/node_modules/semver/LICENSE

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

Loading

0 comments on commit 0c7f93e

Please sign in to comment.