fix: update input warning (#1870)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
77
dist/index.js
generated
vendored
77
dist/index.js
generated
vendored
@@ -1359,28 +1359,28 @@ exports.getSHAForPullRequestEvent = getSHAForPullRequestEvent;
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.UNSUPPORTED_REST_API_INPUTS = void 0;
|
||||
exports.UNSUPPORTED_REST_API_INPUTS = [
|
||||
'sha',
|
||||
'baseSha',
|
||||
'since',
|
||||
'until',
|
||||
'path',
|
||||
'quotepath',
|
||||
'diffRelative',
|
||||
'sinceLastRemoteCommit',
|
||||
'recoverDeletedFiles',
|
||||
'recoverDeletedFilesToDestination',
|
||||
'recoverFiles',
|
||||
'recoverFilesSeparator',
|
||||
'recoverFilesIgnore',
|
||||
'recoverFilesIgnoreSeparator',
|
||||
'includeAllOldNewRenamedFiles',
|
||||
'oldNewSeparator',
|
||||
'oldNewFilesSeparator',
|
||||
'skipInitialFetch',
|
||||
'fetchAdditionalSubmoduleHistory',
|
||||
'dirNamesDeletedFilesIncludeOnlyDeletedDirs'
|
||||
];
|
||||
exports.UNSUPPORTED_REST_API_INPUTS = {
|
||||
sha: '',
|
||||
baseSha: '',
|
||||
since: '',
|
||||
until: '',
|
||||
path: '.',
|
||||
quotepath: true,
|
||||
diffRelative: true,
|
||||
sinceLastRemoteCommit: false,
|
||||
recoverDeletedFiles: false,
|
||||
recoverDeletedFilesToDestination: '',
|
||||
recoverFiles: '',
|
||||
recoverFilesSeparator: '\n',
|
||||
recoverFilesIgnore: '',
|
||||
recoverFilesIgnoreSeparator: '\n',
|
||||
includeAllOldNewRenamedFiles: false,
|
||||
oldNewSeparator: ',',
|
||||
oldNewFilesSeparator: ' ',
|
||||
skipInitialFetch: false,
|
||||
fetchAdditionalSubmoduleHistory: false,
|
||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -1859,12 +1859,7 @@ function run() {
|
||||
((_b = github.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.number) &&
|
||||
(!hasGitDirectory || inputs.useRestApi)) {
|
||||
core.info("Using GitHub's REST API to get changed files");
|
||||
if (process.env.GITHUB_ACTION_PATH) {
|
||||
yield (0, utils_1.warnUnsupportedRESTAPIInputs)({
|
||||
actionPath: path_1.default.join(process.env.GITHUB_ACTION_PATH, 'action.yml'),
|
||||
inputs
|
||||
});
|
||||
}
|
||||
yield (0, utils_1.warnUnsupportedRESTAPIInputs)({ inputs });
|
||||
yield getChangedFilesFromRESTAPI({
|
||||
inputs,
|
||||
filePatterns,
|
||||
@@ -2957,28 +2952,16 @@ exports.hasLocalGitDirectory = hasLocalGitDirectory;
|
||||
/**
|
||||
* Warns about unsupported inputs when using the REST API.
|
||||
*
|
||||
* @param actionPath - The path to the action file.
|
||||
* @param inputs - The inputs object.
|
||||
*/
|
||||
const warnUnsupportedRESTAPIInputs = ({ actionPath, inputs }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _m;
|
||||
const actionContents = yield fs_1.promises.readFile(actionPath, 'utf8');
|
||||
const actionYaml = (0, yaml_1.parseDocument)(actionContents, { schema: 'failsafe' });
|
||||
if (actionYaml.errors.length > 0) {
|
||||
throw new Error(`YAML errors in ${actionPath}: ${actionYaml.errors.join(', ')}`);
|
||||
}
|
||||
if (actionYaml.warnings.length > 0) {
|
||||
throw new Error(`YAML warnings in ${actionPath}: ${actionYaml.warnings.join(', ')}`);
|
||||
}
|
||||
const action = actionYaml.toJS();
|
||||
const actionInputs = action.inputs;
|
||||
for (const key of constant_1.UNSUPPORTED_REST_API_INPUTS) {
|
||||
const inputKey = (0, lodash_1.snakeCase)(key);
|
||||
const defaultValue = Object.hasOwnProperty.call(actionInputs[inputKey], 'default')
|
||||
? actionInputs[inputKey].default.toString()
|
||||
const warnUnsupportedRESTAPIInputs = ({ inputs }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _m, _o;
|
||||
for (const key of Object.keys(constant_1.UNSUPPORTED_REST_API_INPUTS)) {
|
||||
const defaultValue = Object.hasOwnProperty.call(constant_1.UNSUPPORTED_REST_API_INPUTS, key)
|
||||
? (_m = constant_1.UNSUPPORTED_REST_API_INPUTS[key]) === null || _m === void 0 ? void 0 : _m.toString()
|
||||
: '';
|
||||
if (defaultValue !== ((_m = inputs[key]) === null || _m === void 0 ? void 0 : _m.toString())) {
|
||||
core.warning(`Input "${inputKey}" is not supported when using GitHub's REST API to get changed files`);
|
||||
if (defaultValue !== ((_o = inputs[key]) === null || _o === void 0 ? void 0 : _o.toString())) {
|
||||
core.warning(`Input "${(0, lodash_1.snakeCase)(key)}" is not supported when using GitHub's REST API to get changed files`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user