@@ -34913,67 +34913,77 @@ const run = async () => {
34913
34913
const targetColumn = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("target-column");
34914
34914
const ignoredColumns = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("ignored-columns");
34915
34915
const defaultColumn = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("default-column", { required: false });
34916
+ const issueNumberParam = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("issue-number", { required: false });
34916
34917
34917
34918
const TARGET_COLUMN = targetColumn.trim();
34918
34919
const TARGET_LABELS = parseCommaSeparatedInput(targetLabels);
34919
34920
const IGNORED_COLUMNS = parseCommaSeparatedInput(ignoredColumns);
34920
34921
const DEFAULT_COLUMN = defaultColumn ? defaultColumn.trim() : null;
34922
+ const ISSUE_NUMBER_PARAM = issueNumberParam ? issueNumberParam.trim() : null;
34921
34923
34922
34924
const SKIP_IF_NOT_IN_PROJECT =
34923
34925
_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("skip-if-not-in-project") === "true";
34924
34926
34925
34927
const octokit = _actions_github__WEBPACK_IMPORTED_MODULE_1__.getOctokit(token);
34926
34928
34927
- let issue = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.payload.issue;
34928
- if (!issue || !issue.node_id) {
34929
- throw new Error("Invalid or missing issue object");
34930
- }
34929
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Determing issue number...");
34930
+ const issueNumber = ISSUE_NUMBER_PARAM ? ISSUE_NUMBER_PARAM : _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.issue.number;
34931
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Issue number: " + issueNumber);
34931
34932
34932
- const issueNumber = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.issue.number;
34933
- const { owner, repo } = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo;
34934
34933
// The issue might have been updated by a previous GitHub action; therefore, we refetch the issue data
34934
+ const { owner, repo } = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.repo;
34935
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("owner: " + owner + " repo: " + repo);
34935
34936
const { data: updatedIssue } = await octokit.rest.issues.get({
34936
34937
owner,
34937
34938
repo,
34938
34939
issue_number: issueNumber,
34939
34940
});
34940
- issue = updatedIssue;
34941
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Udpated issue " + updatedIssue);
34942
+ const issue = updatedIssue;
34943
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Issue " + issue);
34944
+
34945
+ if (!issue || !issue.node_id) {
34946
+ throw new Error("Invalid or missing issue object");
34947
+ }
34941
34948
34942
34949
const eventName = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.eventName;
34943
34950
const action = _actions_github__WEBPACK_IMPORTED_MODULE_1__.context.payload.action;
34944
34951
const projectData = await getProjectData(octokit, projectUrl);
34945
34952
34946
- if (eventName === "issue_comment") {
34947
- if (action === "created") {
34948
- // a comment was created on an issue
34949
- const hasTargetLabel = issue.labels.some((label) =>
34950
- TARGET_LABELS.includes(label.name)
34953
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Event: " + eventName);
34954
+
34955
+ if ((eventName === "issue_comment") || (eventName === "pull_request") || (eventName === "pull_request_target") || ISSUE_NUMBER_PARAM) {
34956
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Hit issue or PR");
34957
+
34958
+ const hasTargetLabel = issue.labels.some((label) =>
34959
+ TARGET_LABELS.includes(label.name)
34960
+ );
34961
+ if (hasTargetLabel) {
34962
+ // Proceed as if the label was added to the issue
34963
+ await processIssueItem(
34964
+ octokit,
34965
+ projectData,
34966
+ issue,
34967
+ TARGET_COLUMN,
34968
+ IGNORED_COLUMNS,
34969
+ SKIP_IF_NOT_IN_PROJECT
34970
+ );
34971
+ } else {
34972
+ // Proceed as if the label was removed from the issue
34973
+ await moveIssueToDefaultColumn(
34974
+ octokit,
34975
+ projectData,
34976
+ issue,
34977
+ DEFAULT_COLUMN,
34978
+ IGNORED_COLUMNS
34951
34979
);
34952
- if (hasTargetLabel) {
34953
- // Proceed as if the label was added to the issue
34954
- await processIssueItem(
34955
- octokit,
34956
- projectData,
34957
- issue,
34958
- TARGET_COLUMN,
34959
- IGNORED_COLUMNS,
34960
- SKIP_IF_NOT_IN_PROJECT
34961
- );
34962
- } else {
34963
- // Proceed as if the label was removed from the issue
34964
- await moveIssueToDefaultColumn(
34965
- octokit,
34966
- projectData,
34967
- issue,
34968
- DEFAULT_COLUMN,
34969
- IGNORED_COLUMNS
34970
- );
34971
- }
34972
- return;
34973
34980
}
34981
+ return;
34974
34982
}
34975
34983
34976
34984
if (action === "labeled") {
34985
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Hit labeled");
34986
+
34977
34987
await handleLabeledEvent(
34978
34988
octokit,
34979
34989
issue,
@@ -34987,6 +34997,8 @@ const run = async () => {
34987
34997
}
34988
34998
34989
34999
if (action === "unlabeled" && DEFAULT_COLUMN) {
35000
+ _actions_core__WEBPACK_IMPORTED_MODULE_0__.debug("Hit unlabeled");
35001
+
34990
35002
await handleUnlabeledEvent(
34991
35003
octokit,
34992
35004
issue,
0 commit comments