10000 test · actions/github-script@2e3aba3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e3aba3

Browse files
test
1 parent ec5277f commit 2e3aba3

File tree

4 files changed

+15
-41
lines changed

4 files changed

+15
-41
lines changed

action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ branding:
77
inputs:
88
script:
99
description: The script to run
10-
required: true
1110
file:
12-
description: The script file to run
11+
description: The javascript file to run
1312
github-token:
1413
description: The GitHub token used to create an authenticated client
1514
default: ${{ github.token }}

dist/index.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9301,15 +9301,11 @@ function callAsyncFunction(args, source) {
93019301
// EXTERNAL MODULE: external "fs"
93029302
var external_fs_ = __webpack_require__(747);
93039303

9304-
// EXTERNAL MODULE: external "path"
9305-
var external_path_ = __webpack_require__(622);
9306-
93079304
// CONCATENATED MODULE: ./src/main.ts
93089305

93099306

93109307

93119308

9312-
93139309
process.on('unhandledRejection', handleError);
93149310
main().catch(handleError);
93159311
async function main() {
@@ -9325,24 +9321,14 @@ async function main() {
93259321
if (previews != null)
93269322
opts.previews = previews.split(',');
93279323
const github = new lib_github.GitHub(token, opts);
9328-
let script = Object(core.getInput)('script', { required: true });
9324+
let script = Object(core.getInput)('script');
93299325
const file = Object(core.getInput)('file');
9330-
Object(core.debug)('------');
9331-
Object(core.debug)(script);
9332-
Object(core.debug)(file);
9333-
// @ts-ignore
9334-
Object(core.debug)(process.env.GITHUB_WORKSPACE);
9335-
Object(core.debug)(__dirname);
9336-
Object(core.debug)(__filename);
9337-
Object(core.debug)('-------');
9338-
// @ts-ignore
9339-
const filePath = Object(external_path_.join)(process.env.GITHUB_WORKSPACE, file);
9340-
Object(core.debug)(filePath);
9341-
if (Object(external_fs_.existsSync)(filePath)) {
9342-
Object(core.debug)('Inside try block');
9343-
script = Object(external_fs_.readFileSync)(filePath, 'utf-8');
9326+
if (file) {
9327+
if (!Object(external_fs_.existsSync)(file)) {
9328+
throw new Error('file can\'t be found: ' + file);
9329+
}
9330+
script = Object(external_fs_.readFileSync)(file, 'utf-8');
93449331
}
9345-
Object(core.debug)(script);
93469332
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
93479333
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context, core: core }, script);
93489334
let encoding = Object(core.getInput)('result-encoding');

src/main.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,18 @@ async function main() {
1717
if (userAgent != null) opts.userAgent = userAgent
1818
if (previews != null) opts.previews = previews.split(',')
1919
const github = new GitHub(token, opts)
20-
let script = core.getInput('script', { required: true })
20+
21+
let script = core.getInput('script')
2122
const file = core.getInput('file')
2223

24+
if(file){
25+
if(!existsSync(file)){
26+
throw new Error('file can\'t be found: ' + file)
27+
}
2328

24-
core.debug('------')
25-
core.debug(script);
26-
core.debug(file);
27-
// @ts-ignore
28-
core.debug(process.env.GITHUB_WORKSPACE)
29-
core.debug(__dirname)
30-
core.debug(__filename)
31-
core.debug('-------')
32-
33-
// @ts-ignore
34-
const filePath = join(process.env.GITHUB_WORKSPACE, file)
35-
core.debug(filePath)
36-
if(existsSync(filePath)){
37-
core.debug('Inside try block');
38-
script = readFileSync(filePath, 'utf-8')
29+
script = readFileSync(file, 'utf-8')
3930
}
4031

41-
core.debug(script);
42-
4332
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilatin errors.
4433
const result = await callAsyncFunction(
4534
{require: require, github, context, core},

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@
644644
jest-diff "^25.2.1"
645645
pretty-format "^25.2.1"
646646

647-
"@types/node@>= 8":
647+
"@types/node@>= 8", "@types/node@^13.13.1":
648648
version "13.13.1"
649649
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.1.tgz#1ba94c5a177a1692518bfc7b41aec0aa1a14354e"
650650
integrity sha512-uysqysLJ+As9jqI5yqjwP3QJrhOcUwBjHUlUxPxjbplwKoILvXVsmYWEhfmAQlrPfbRZmhJB007o4L9sKqtHqQ==

0 commit comments

Comments
 (0)
0