Skip to content

Commit ddba1b1

Browse files
committed
Use non-Webpack-require in evaluated scripts
1 parent 59cb74c commit ddba1b1

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

dist/index.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6144,7 +6144,7 @@ async function main() {
61446144
const github = Object(lib_github.getOctokit)(token, opts);
61456145
const script = Object(core.getInput)('script', { required: true });
61466146
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
6147-
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context, core: core, glob: glob, io: io }, script);
6147+
const result = await callAsyncFunction({ require: require, github, context: lib_github.context, core: core, glob: glob, io: io }, script);
61486148
let encoding = Object(core.getInput)('result-encoding');
61496149
encoding = encoding ? encoding : 'json';
61506150
let output;
@@ -6901,25 +6901,6 @@ function expand(str, isTop) {
69016901

69026902

69036903

6904-
/***/ }),
6905-
6906-
/***/ 875:
6907-
/***/ (function(module) {
6908-
6909-
function webpackEmptyContext(req) {
6910-
if (typeof req === 'number' && __webpack_require__.m[req])
6911-
return __webpack_require__(req);
6912-
try { return require(req) }
6913-
catch (e) { if (e.code !== 'MODULE_NOT_FOUND') throw e }
6914-
var e = new Error("Cannot find module '" + req + "'");
6915-
e.code = 'MODULE_NOT_FOUND';
6916-
throw e;
6917-
}
6918-
webpackEmptyContext.keys = function() { return []; };
6919-
webpackEmptyContext.resolve = webpackEmptyContext;
6920-
module.exports = webpackEmptyContext;
6921-
webpackEmptyContext.id = 875;
6922-
69236904
/***/ }),
69246905

69256906
/***/ 877:

src/async-function.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as core from '@actions/core'
2-
import {Context} from '@actions/github/lib/context'
3-
import {GitHub} from '@actions/github/lib/utils'
2+
import { Context } from '@actions/github/lib/context'
3+
import { GitHub } from '@actions/github/lib/utils'
44
import * as glob from '@actions/glob'
55
import * as io from '@actions/io'
66

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import * as glob from '@actions/glob'
44
import * as io from '@actions/io'
55
import {callAsyncFunction} from './async-function'
66

7+
declare const __non_webpack_require__: typeof require
8+
79
process.on('unhandledRejection', handleError)
810
main().catch(handleError)
911

@@ -29,7 +31,7 @@ async function main(): Promise<void> {
2931

3032
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
3133
const result = await callAsyncFunction(
32-
{require: require, github, context, core, glob, io},
34+
{require: __non_webpack_require__, github, context, core, glob, io},
3335
script
3436
)
3537

0 commit comments

Comments
 (0)