remove path input param

This commit is contained in:
ddivad195
2024-01-30 11:04:39 +00:00
parent b0301f588c
commit 5fc6c86976
8 changed files with 34 additions and 346 deletions
+11 -11
View File
@@ -73,7 +73,7 @@ describe('run', () => {
process.env.GITHUB_REPOSITORY = ''
// Run the action
await main.run('directory1 directory2')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Could not find Repository.')
@@ -85,7 +85,7 @@ describe('run', () => {
process.env.TOKEN = ''
// Run the action
await main.run('directory1 directory2')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Could not find GITHUB_TOKEN.')
@@ -98,7 +98,7 @@ describe('run', () => {
process.env.GITHUB_SHA = ''
// Run the action
await main.run('')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Could not find source commit.')
@@ -127,7 +127,7 @@ describe('run', () => {
github.context.eventName = 'push'
github.context.ref = 'refs/heads/main' // This is a branch, not a tag
await main.run('')
await main.run()
expect(setFailedMock).toHaveBeenCalledWith(
'This action can only be triggered by release events or tag push events.'
@@ -150,7 +150,7 @@ describe('run', () => {
}
}
await main.run('')
await main.run()
expect(setFailedMock).toHaveBeenCalledWith(
`${tag} is not a valid semantic version, and so cannot be uploaded as an Immutable Action.`
)
@@ -175,7 +175,7 @@ describe('run', () => {
})
// Run the action
await main.run('')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Something went wrong')
@@ -199,7 +199,7 @@ describe('run', () => {
})
// Run the action
await main.run('')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Something went wrong')
@@ -223,7 +223,7 @@ describe('run', () => {
})
// Run the action
await main.run('')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Something went wrong')
@@ -265,7 +265,7 @@ describe('run', () => {
})
// Run the action
await main.run('')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Something went wrong')
@@ -311,7 +311,7 @@ describe('run', () => {
})
// Run the action
await main.run('')
await main.run()
// Check the results
expect(setFailedMock).toHaveBeenCalledWith('Something went wrong')
@@ -362,7 +362,7 @@ describe('run', () => {
})
// Run the action
await main.run('')
await main.run()
// Check the results
expect(publishOCIArtifactMock).toHaveBeenCalledTimes(1)
+2 -7
View File
@@ -11,12 +11,6 @@ branding:
icon: 'heart'
color: 'red'
inputs:
path:
required: false
description: The work directory or path to be tar archived and uploaded as OCI Artifact layer.
default: '.'
outputs:
package-url:
description: 'The name of package published to GHCR along with semver. For example, https://ghcr.io/actions/package-action:1.0.1'
@@ -27,11 +21,12 @@ outputs:
package-manifest-sha:
description: 'A sha256 hash of the package manifest'
value: ${{steps.publish.outputs.package-manifest-sha}}
runs:
using: 'composite'
steps:
- name: Publish Action Package
run: 'node ${{github.action_path}}/dist/index.js --path ${{ inputs.path }}'
run: 'node ${{github.action_path}}/dist/index.js'
shell: bash
id: publish
env:
Generated Vendored
+18 -300
View File
@@ -33737,277 +33737,6 @@ function populateMaps (extensions, types) {
}
/***/ }),
/***/ 35871:
/***/ ((module) => {
"use strict";
function hasKey(obj, keys) {
var o = obj;
keys.slice(0, -1).forEach(function (key) {
o = o[key] || {};
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber(x) {
if (typeof x === 'number') { return true; }
if ((/^0x[0-9a-f]+$/i).test(x)) { return true; }
return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x);
}
function isConstructorOrProto(obj, key) {
return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';
}
module.exports = function (args, opts) {
if (!opts) { opts = {}; }
var flags = {
bools: {},
strings: {},
unknownFn: null,
};
if (typeof opts.unknown === 'function') {
flags.unknownFn = opts.unknown;
}
if (typeof opts.boolean === 'boolean' && opts.boolean) {
flags.allBools = true;
} else {
[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
});
}
var aliases = {};
function aliasIsBoolean(key) {
return aliases[key].some(function (x) {
return flags.bools[x];
});
}
Object.keys(opts.alias || {}).forEach(function (key) {
aliases[key] = [].concat(opts.alias[key]);
aliases[key].forEach(function (x) {
aliases[x] = [key].concat(aliases[key].filter(function (y) {
return x !== y;
}));
});
});
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
if (aliases[key]) {
[].concat(aliases[key]).forEach(function (k) {
flags.strings[k] = true;
});
}
});
var defaults = opts.default || {};
var argv = { _: [] };
function argDefined(key, arg) {
return (flags.allBools && (/^--[^=]+$/).test(arg))
|| flags.strings[key]
|| flags.bools[key]
|| aliases[key];
}
function setKey(obj, keys, value) {
var o = obj;
for (var i = 0; i < keys.length - 1; i++) {
var key = keys[i];
if (isConstructorOrProto(o, key)) { return; }
if (o[key] === undefined) { o[key] = {}; }
if (
o[key] === Object.prototype
|| o[key] === Number.prototype
|| o[key] === String.prototype
) {
o[key] = {};
}
if (o[key] === Array.prototype) { o[key] = []; }
o = o[key];
}
var lastKey = keys[keys.length - 1];
if (isConstructorOrProto(o, lastKey)) { return; }
if (
o === Object.prototype
|| o === Number.prototype
|| o === String.prototype
) {
o = {};
}
if (o === Array.prototype) { o = []; }
if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {
o[lastKey] = value;
} else if (Array.isArray(o[lastKey])) {
o[lastKey].push(value);
} else {
o[lastKey] = [o[lastKey], value];
}
}
function setArg(key, val, arg) {
if (arg && flags.unknownFn && !argDefined(key, arg)) {
if (flags.unknownFn(arg) === false) { return; }
}
var value = !flags.strings[key] && isNumber(val)
? Number(val)
: val;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), value);
});
}
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
});
var notFlags = [];
if (args.indexOf('--') !== -1) {
notFlags = args.slice(args.indexOf('--') + 1);
args = args.slice(0, args.indexOf('--'));
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
var key;
var next;
if ((/^--.+=/).test(arg)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== 'false';
}
setArg(key, value, arg);
} else if ((/^--no-.+/).test(arg)) {
key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
} else if ((/^--.+/).test(arg)) {
key = arg.match(/^--(.+)/)[1];
next = args[i + 1];
if (
next !== undefined
&& !(/^(-|--)[^-]/).test(next)
&& !flags.bools[key]
&& !flags.allBools
&& (aliases[key] ? !aliasIsBoolean(key) : true)
) {
setArg(key, next, arg);
i += 1;
} else if ((/^(true|false)$/).test(next)) {
setArg(key, next === 'true', arg);
i += 1;
} else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
} else if ((/^-[^-]+/).test(arg)) {
var letters = arg.slice(1, -1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
next = arg.slice(j + 2);
if (next === '-') {
setArg(letters[j], next, arg);
continue;
}
if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {
setArg(letters[j], next.slice(1), arg);
broken = true;
break;
}
if (
(/[A-Za-z]/).test(letters[j])
&& (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next)
) {
setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
setArg(letters[j], arg.slice(j + 2), arg);
broken = true;
break;
} else {
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
}
}
key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (
args[i + 1]
&& !(/^(-|--)[^-]/).test(args[i + 1])
&& !flags.bools[key]
&& (aliases[key] ? !aliasIsBoolean(key) : true)
) {
setArg(key, args[i + 1], arg);
i += 1;
} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {
setArg(key, args[i + 1] === 'true', arg);
i += 1;
} else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
} else {
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
}
if (opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
}
Object.keys(defaults).forEach(function (k) {
if (!hasKey(argv, k.split('.'))) {
setKey(argv, k.split('.'), defaults[k]);
(aliases[k] || []).forEach(function (x) {
setKey(argv, x.split('.'), defaults[k]);
});
}
});
if (opts['--']) {
argv['--'] = notFlags.slice();
} else {
notFlags.forEach(function (k) {
argv._.push(k);
});
}
return argv;
};
/***/ }),
/***/ 41077:
@@ -75019,27 +74748,6 @@ function configureRequestDebugLogging() {
}
/***/ }),
/***/ 6144:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
/**
* The entrypoint for the action.
*/
const main_1 = __nccwpck_require__(70399);
const minimist_1 = __importDefault(__nccwpck_require__(35871));
const path = (0, minimist_1.default)(process.argv.slice(2)).path || '.';
// eslint-disable-next-line @typescript-eslint/no-floating-promises
(0, main_1.run)(path);
/***/ }),
/***/ 70399:
@@ -75086,7 +74794,7 @@ const semver_1 = __importDefault(__nccwpck_require__(11383));
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
async function run(pathInput) {
async function run() {
const tmpDirs = [];
try {
const repository = process.env.GITHUB_REPOSITORY || '';
@@ -79881,12 +79589,22 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __nccwpck_require__(6144);
/******/ module.exports = __webpack_exports__;
/******/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({ value: true }));
/**
* The entrypoint for the action.
*/
const main_1 = __nccwpck_require__(70399);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
(0, main_1.run)();
})();
module.exports = __webpack_exports__;
/******/ })()
;
Generated Vendored
-22
View File
@@ -1528,28 +1528,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
minimist
MIT
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
minipass
ISC
The ISC License
+1 -1
View File
@@ -17,7 +17,6 @@
"axios": "^1.6.2",
"axios-debug-log": "^1.0.0",
"fs-extra": "^11.1.1",
"minimist": "^1.2.8",
"tar": "^6.2.0"
},
"devDependencies": {
@@ -6165,6 +6164,7 @@
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
-1
View File
@@ -74,7 +74,6 @@
"axios": "^1.6.2",
"axios-debug-log": "^1.0.0",
"fs-extra": "^11.1.1",
"minimist": "^1.2.8",
"tar": "^6.2.0"
},
"devDependencies": {
+1 -3
View File
@@ -2,8 +2,6 @@
* The entrypoint for the action.
*/
import { run } from './main'
import minimist from 'minimist'
const path = minimist(process.argv.slice(2)).path || '.'
// eslint-disable-next-line @typescript-eslint/no-floating-promises
run(path)
run()
+1 -1
View File
@@ -10,7 +10,7 @@ import semver from 'semver'
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
export async function run(pathInput: string): Promise<void> {
export async function run(): Promise<void> {
const tmpDirs: string[] = []
try {