Skip to content

Commit ffc920a

Browse files
committed
update dist
1 parent 2f8ef64 commit ffc920a

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

dist/index.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ module.exports = new Schema({
491491
"use strict";
492492

493493
Object.defineProperty(exports, "__esModule", { value: true });
494-
exports.FLAG_KEYWORD = exports.SUPPORT_ACTION_EVENT = void 0;
495-
exports.SUPPORT_ACTION_EVENT = ['moved', 'created', 'converted'];
494+
exports.FLAG_KEYWORD = exports.SUPPORT_WEBHOOK_EVENT = void 0;
495+
exports.SUPPORT_WEBHOOK_EVENT = ['issues', 'pull_request'];
496496
exports.FLAG_KEYWORD = {
497497
SKIP_ACTION: '[SKIP_ACTION]'
498498
};
@@ -2956,6 +2956,9 @@ function run() {
29562956
core_1.debug(utils_1.prettyStringify(core_1.getInput('config')));
29572957
core_1.endGroup();
29582958
try {
2959+
if (!utils_1.isSupportActionEvent()) {
2960+
throw Error('Triggered from can not support action event.');
2961+
}
29592962
const token = libs_1.getGitHubToken();
29602963
const octokit = libs_1.getOctokit(token);
29612964
const config = yield libs_1.getConfig({ context: github_1.context, octokit });
@@ -2970,9 +2973,15 @@ function run() {
29702973
targetColumnId: targetColumn.id,
29712974
issuesOrPullrequests: relatedIssuesOrPullrequests
29722975
});
2976+
core_1.startGroup('::debug::relatedIssuesOrPullrequests');
29732977
core_1.debug(utils_1.prettyStringify(relatedIssuesOrPullrequests));
2978+
core_1.endGroup();
2979+
core_1.startGroup('::debug::targetColumn');
29742980
core_1.debug(utils_1.prettyStringify(targetColumn));
2981+
core_1.endGroup();
2982+
core_1.startGroup('::debug::moveResult');
29752983
core_1.debug(utils_1.prettyStringify(moveResult));
2984+
core_1.endGroup();
29762985
}
29772986
catch (error) {
29782987
libs_1.thrownHandler(error);
@@ -3484,6 +3493,9 @@ function moveIssuesOrPullRequests(params) {
34843493
return __awaiter(this, void 0, void 0, function* () {
34853494
const { octokit, config, issuesOrPullrequests, targetColumnId } = params;
34863495
const { projectName } = config;
3496+
if (!issuesOrPullrequests.length) {
3497+
throw new Error(utils_1.createSkipActionMessage('There is no issue or pull_request to move'));
3498+
}
34873499
const cardNodes = issuesOrPullrequests.map((issueOrPullRequest) => getIssueOrPullRequestCardNode_1.getIssueOrPullRequestCardNode({
34883500
repositoryIssueOrPullRequest: issueOrPullRequest,
34893501
targetProjectName: projectName
@@ -9353,10 +9365,8 @@ exports.isSupportActionEvent = void 0;
93539365
const github_1 = __webpack_require__(469);
93549366
const constants_1 = __webpack_require__(32);
93559367
function isSupportActionEvent() {
9356-
var _a;
9357-
const hasProjectCardContext = (_a = github_1.context.payload) === null || _a === void 0 ? void 0 : _a.project_card;
9358-
const isSupportEvent = constants_1.SUPPORT_ACTION_EVENT.some((event) => event === github_1.context.payload.action);
9359-
return hasProjectCardContext && isSupportEvent;
9368+
const isSupportWebhookEvent = constants_1.SUPPORT_WEBHOOK_EVENT.some((event) => event === github_1.context.eventName);
9369+
return isSupportWebhookEvent;
93609370
}
93619371
exports.isSupportActionEvent = isSupportActionEvent;
93629372

@@ -13254,6 +13264,7 @@ function getGitHubToken() {
1325413264
}
1325513265
exports.getGitHubToken = getGitHubToken;
1325613266
function getConfig({ octokit, context }) {
13267+
var _a, _b;
1325713268
return __awaiter(this, void 0, void 0, function* () {
1325813269
const configPath = core_1.getInput('config');
1325913270
core_1.debug(configPath);
@@ -13264,6 +13275,12 @@ function getConfig({ octokit, context }) {
1326413275
if (!lodash_isobject_1.default(config) || !(config instanceof Object)) {
1326513276
throw Error('config is malformed');
1326613277
}
13278+
if (!((_a = config) === null || _a === void 0 ? void 0 : _a.projectName)) {
13279+
throw Error('not found `projectName` in config');
13280+
}
13281+
if (!((_b = config) === null || _b === void 0 ? void 0 : _b.columnName)) {
13282+
throw Error('not found `columnName` in config');
13283+
}
1326713284
return config;
1326813285
});
1326913286
}

0 commit comments

Comments
 (0)