Skip to content

Commit 1b37c89

Browse files
committed
feat: update asana regex
1 parent 592aafe commit 1b37c89

File tree

8 files changed

+30
-24
lines changed

8 files changed

+30
-24
lines changed

dist/action.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3232
});
3333
};
3434
Object.defineProperty(exports, "__esModule", { value: true });
35-
exports.buildClient = void 0;
36-
exports.action = action;
35+
exports.buildClient = exports.action = void 0;
3736
const core = __importStar(require("@actions/core"));
3837
const github = __importStar(require("@actions/github"));
3938
const asana_action_1 = require("./asana/asana-action");
@@ -47,7 +46,7 @@ function action() {
4746
const ACTION = core.getInput("action", { required: true });
4847
const TRIGGER_PHRASE = core.getInput("trigger-phrase") || "";
4948
const PULL_REQUEST = github.context.payload.pull_request;
50-
const REGEX_STRING = `${TRIGGER_PHRASE}(?:\s*)https:\\/\\/app.asana.com\\/(\\d+)\\/(?<project>\\d+)\\/(?<task>\\d+)`;
49+
const REGEX_STRING = `${TRIGGER_PHRASE}(?:\\s*)https:\\/\\/app\\.asana\\.com\\/\\d+\\/(?:\\d+|\\w+)\\/(?:project|projects)\\/\\d+\\/(?:task|tasks)\\/(?<task>\\d+)`;
5150
const REGEX = new RegExp(REGEX_STRING, "g");
5251
const shopifyActions = ["create-theme", "update-theme", "delete-theme"];
5352
const isShopifyAction = shopifyActions.includes(ACTION);
@@ -247,3 +246,4 @@ function action() {
247246
}
248247
});
249248
}
249+
exports.action = action;

dist/asana/asana-action.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3232
});
3333
};
3434
Object.defineProperty(exports, "__esModule", { value: true });
35-
exports.addComment = addComment;
36-
exports.buildClient = buildClient;
37-
exports.findComment = findComment;
38-
exports.migrateSection = migrateSection;
39-
exports.moveSection = moveSection;
40-
exports.updateSection = updateSection;
41-
exports.updateTask = updateTask;
35+
exports.updateTask = exports.updateSection = exports.moveSection = exports.migrateSection = exports.findComment = exports.buildClient = exports.addComment = void 0;
4236
const core = __importStar(require("@actions/core"));
4337
const asana = __importStar(require("asana"));
4438
// types not working asana
@@ -63,6 +57,7 @@ function moveSection(client, taskId, targets) {
6357
}
6458
});
6559
}
60+
exports.moveSection = moveSection;
6661
function updateTask(client, taskId, targets) {
6762
return __awaiter(this, void 0, void 0, function* () {
6863
const task = yield client.tasks.findById(taskId);
@@ -80,6 +75,7 @@ function updateTask(client, taskId, targets) {
8075
}
8176
});
8277
}
78+
exports.updateTask = updateTask;
8379
function updateSection(client, targets) {
8480
return __awaiter(this, void 0, void 0, function* () {
8581
for (const target of targets) {
@@ -114,6 +110,7 @@ function updateSection(client, targets) {
114110
}
115111
});
116112
}
113+
exports.updateSection = updateSection;
117114
function migrateSection(client, targets) {
118115
return __awaiter(this, void 0, void 0, function* () {
119116
for (const target of targets) {
@@ -140,6 +137,7 @@ function migrateSection(client, targets) {
140137
}
141138
});
142139
}
140+
exports.migrateSection = migrateSection;
143141
function findComment(client, taskId, commentId) {
144142
return __awaiter(this, void 0, void 0, function* () {
145143
let stories;
@@ -154,6 +152,7 @@ function findComment(client, taskId, commentId) {
154152
return stories.find((story) => story.text.indexOf(commentId) !== -1);
155153
});
156154
}
155+
exports.findComment = findComment;
157156
function addComment(client, taskId, commentId, text, isPinned) {
158157
return __awaiter(this, void 0, void 0, function* () {
159158
if (commentId) {
@@ -172,6 +171,7 @@ function addComment(client, taskId, commentId, text, isPinned) {
172171
}
173172
});
174173
}
174+
exports.addComment = addComment;
175175
function buildClient(asanaPAT) {
176176
return __awaiter(this, void 0, void 0, function* () {
177177
return asana.Client.create({
@@ -183,3 +183,4 @@ function buildClient(asanaPAT) {
183183
.authorize();
184184
});
185185
}
186+
exports.buildClient = buildClient;

dist/shopify/check-theme.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99
});
1010
};
1111
Object.defineProperty(exports, "__esModule", { value: true });
12-
exports.checkTheme = checkTheme;
12+
exports.checkTheme = void 0;
1313
const exec_1 = require("@actions/exec");
14-
function checkTheme(root_1) {
15-
return __awaiter(this, arguments, void 0, function* (root, shopifyExecutable = "shopify", devPreview = true, flags = "") {
14+
function checkTheme(root, shopifyExecutable = "shopify", devPreview = true, flags = "") {
15+
return __awaiter(this, void 0, void 0, function* () {
1616
const { exitCode, stdout, stderr } = yield (0, exec_1.getExecOutput)(shopifyExecutable, [
1717
"theme",
1818
"check",
@@ -31,3 +31,4 @@ function checkTheme(root_1) {
3131
};
3232
});
3333
}
34+
exports.checkTheme = checkTheme;

dist/shopify/delete-theme.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1212
return (mod && mod.__esModule) ? mod : { "default": mod };
1313
};
1414
Object.defineProperty(exports, "__esModule", { value: true });
15-
exports.deleteTheme = deleteTheme;
15+
exports.deleteTheme = void 0;
1616
const node_fetch_1 = __importDefault(require("node-fetch"));
1717
const get_theme_1 = require("./get-theme");
1818
function deleteTheme(themeName, shopifyAuth) {
@@ -39,3 +39,4 @@ function deleteTheme(themeName, shopifyAuth) {
3939
return data;
4040
});
4141
}
42+
exports.deleteTheme = deleteTheme;

dist/shopify/deploy-theme.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99
});
1010
};
1111
Object.defineProperty(exports, "__esModule", { value: true });
12-
exports.deployTheme = deployTheme;
12+
exports.deployTheme = void 0;
1313
const exec_1 = require("@actions/exec");
1414
/**
1515
* Deploy a Shopify theme to the specified store.
@@ -22,13 +22,13 @@ const exec_1 = require("@actions/exec");
2222
* @param flags Additional flags as a single string, will be split into an array.
2323
* @returns A promise resolving to an object with the exit code and parsed JSON output from the command.
2424
*/
25-
function deployTheme(root_1) {
26-
return __awaiter(this, arguments, void 0, function* (root, shopifyExecutable = "shopify", themeName, password, store, devPreview = false, flags = "") {
25+
function deployTheme(root, shopifyExecutable = "shopify", themeName, password, store, devPreview = false, flags = "") {
26+
return __awaiter(this, void 0, void 0, function* () {
2727
const commandArgs = [
2828
"theme",
2929
"push",
3030
devPreview ? "--development" : undefined,
31-
"--json", // Ensures JSON output for parsing
31+
"--json",
3232
...flags.split(" "),
3333
"--path",
3434
root,
@@ -53,3 +53,4 @@ function deployTheme(root_1) {
5353
};
5454
});
5555
}
56+
exports.deployTheme = deployTheme;

dist/shopify/install-cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1212
return (mod && mod.__esModule) ? mod : { "default": mod };
1313
};
1414
Object.defineProperty(exports, "__esModule", { value: true });
15-
exports.installCli = installCli;
15+
exports.installCli = void 0;
1616
const exec_1 = require("@actions/exec");
1717
const semver_1 = __importDefault(require("semver"));
1818
const MIN_VERSION = "3.50.0";
@@ -32,6 +32,7 @@ function installCli(version) {
3232
].filter(Boolean));
3333
});
3434
}
35+
exports.installCli = installCli;
3536
function shouldIncludeTheme(version) {
3637
if (!version || version.includes("experimental")) {
3738
return false;

dist/shopify/shopify.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99
});
1010
};
1111
Object.defineProperty(exports, "__esModule", { value: true });
12-
exports.createTheme = createTheme;
13-
exports.runCheckTheme = runCheckTheme;
14-
exports.updateTheme = updateTheme;
15-
exports.removeTheme = removeTheme;
12+
exports.removeTheme = exports.updateTheme = exports.runCheckTheme = exports.createTheme = void 0;
1613
const check_theme_1 = require("./check-theme");
1714
const delete_theme_1 = require("./delete-theme");
1815
const deploy_theme_1 = require("./deploy-theme");
@@ -37,6 +34,7 @@ function createTheme(shopifyAuth) {
3734
}
3835
});
3936
}
37+
exports.createTheme = createTheme;
4038
// Function to check theme
4139
function runCheckTheme() {
4240
return __awaiter(this, void 0, void 0, function* () {
@@ -50,6 +48,7 @@ function runCheckTheme() {
5048
}
5149
});
5250
}
51+
exports.runCheckTheme = runCheckTheme;
5352
// Function to update an existing theme
5453
function updateTheme(shopifyAuth) {
5554
return __awaiter(this, void 0, void 0, function* () {
@@ -66,6 +65,7 @@ function updateTheme(shopifyAuth) {
6665
}
6766
});
6867
}
68+
exports.updateTheme = updateTheme;
6969
// Function to remove a theme
7070
function removeTheme(shopifyAuth) {
7171
return __awaiter(this, void 0, void 0, function* () {
@@ -80,3 +80,4 @@ function removeTheme(shopifyAuth) {
8080
}
8181
});
8282
}
83+
exports.removeTheme = removeTheme;

src/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function action() {
2323
const ACTION: string = core.getInput("action", { required: true });
2424
const TRIGGER_PHRASE: string = core.getInput("trigger-phrase") || "";
2525
const PULL_REQUEST = github.context.payload.pull_request;
26-
const REGEX_STRING: string = `${TRIGGER_PHRASE}(?:\s*)https:\\/\\/app.asana.com\\/(\\d+)\\/(?<project>\\d+)\\/(?<task>\\d+)`;
26+
const REGEX_STRING: string = `${TRIGGER_PHRASE}(?:\\s*)https:\\/\\/app\\.asana\\.com\\/\\d+\\/(?:\\d+|\\w+)\\/(?:project|projects)\\/\\d+\\/(?:task|tasks)\\/(?<task>\\d+)`;
2727
const REGEX = new RegExp(REGEX_STRING, "g");
2828
const shopifyActions = ["create-theme", "update-theme", "delete-theme"];
2929
const isShopifyAction = shopifyActions.includes(ACTION);

0 commit comments

Comments
 (0)