Skip to content

Commit 1e86cdf

Browse files
committed
Minor refactor
1 parent 6fbdd4d commit 1e86cdf

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

dist/index.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34479,6 +34479,14 @@ const parseCommaSeparatedInput = (input) => {
3447934479
return input.split(",").map((item) => item.trim());
3448034480
};
3448134481

34482+
const parseProjectUrl = (url) => {
34483+
const parts = url.split("/");
34484+
return {
34485+
orgName: parts[parts.length - 3],
34486+
projectUrl: url,
34487+
};
34488+
};
34489+
3448234490
const validateIssue = (issue, TARGET_LABELS) => {
3448334491
if (!issue || !issue.node_id) {
3448434492
throw new Error("Invalid or missing issue object");
@@ -34488,15 +34496,7 @@ const validateIssue = (issue, TARGET_LABELS) => {
3448834496
throw new Error(`Issue #${issue.number} does not have a target label`);
3448934497
}
3449034498

34491-
return true;
34492-
};
34493-
34494-
const parseProjectUrl = (url) => {
34495-
const parts = url.split("/");
34496-
return {
34497-
orgName: parts[parts.length - 3],
34498-
projectUrl: url,
34499-
};
34499+
return;
3450034500
};
3450134501

3450234502
const fetchAllProjects = async (
@@ -34747,11 +34747,10 @@ const run = async () => {
3474734747
const octokit = github.getOctokit(token);
3474834748
const issue = github.context.payload.issue;
3474934749

34750-
if (!validateIssue(issue, TARGET_LABELS)) {
34751-
return;
34752-
}
34750+
validateIssue(issue, TARGET_LABELS);
3475334751

3475434752
const projectData = await getProjectData(octokit, projectUrl);
34753+
3475534754
await processIssueItem(
3475634755
octokit,
3475734756
projectData,

index.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ const parseCommaSeparatedInput = (input) => {
55
return input.split(",").map((item) => item.trim());
66
};
77

8+
const parseProjectUrl = (url) => {
9+
const parts = url.split("/");
10+
return {
11+
orgName: parts[parts.length - 3],
12+
projectUrl: url,
13+
};
14+
};
15+
816
const validateIssue = (issue, TARGET_LABELS) => {
917
if (!issue || !issue.node_id) {
1018
throw new Error("Invalid or missing issue object");
@@ -14,15 +22,7 @@ const validateIssue = (issue, TARGET_LABELS) => {
1422
throw new Error(`Issue #${issue.number} does not have a target label`);
1523
}
1624

17-
return true;
18-
};
19-
20-
const parseProjectUrl = (url) => {
21-
const parts = url.split("/");
22-
return {
23-
orgName: parts[parts.length - 3],
24-
projectUrl: url,
25-
};
25+
return;
2626
};
2727

2828
const fetchAllProjects = async (
@@ -273,11 +273,10 @@ const run = async () => {
273273
const octokit = github.getOctokit(token);
274274
const issue = github.context.payload.issue;
275275

276-
if (!validateIssue(issue, TARGET_LABELS)) {
277-
return;
278-
}
276+
validateIssue(issue, TARGET_LABELS);
279277

280278
const projectData = await getProjectData(octokit, projectUrl);
279+
281280
await processIssueItem(
282281
octokit,
283282
projectData,

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-action-move-issues",
3-
"version": "1.0.7",
3+
"version": "1.0.9",
44
"description": "A GitHub Action to move issues between GitHub Projects V2 columns based on labels.",
55
"main": "dist/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)