Skip to content

Commit

Permalink
Fix tests, improve debug (#68)
Browse files Browse the repository at this point in the history
* Improve debug

* Improve prettier

* Fix tests
  • Loading branch information
callms committed Aug 3, 2023
1 parent 4afb29e commit de867eb
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions action.js
Expand Up @@ -359,6 +359,16 @@ function getAwsAmplifyLiveUrls({ id, labels, amplifyUri }) {
}

exports.action = async function action() {
try {
return await actionImpl();
} catch (error) {
console.error(error);
core.setFailed(error.message);
throw error;
}
};

async function actionImpl() {
// check if we run on a merge_group
const {
mergeGroup,
Expand All @@ -384,7 +394,7 @@ exports.action = async function action() {
});
//console.log("pull", pullRequest);
console.log("asanaPRStatus", asanaPRStatus);
const labels = pullRequest.labels.map(({ name }) => name);
const labels = (pullRequest.labels || []).map(({ name }) => name);

console.info(`Calling action ${action}`);
switch (action) {
Expand All @@ -398,8 +408,10 @@ exports.action = async function action() {
if (!taskId) {
console.log("Cannot update Asana task: no taskId was found");
} else {
const pullRequestNumber =
pullRequest.number || pullRequest.html_url.split("/").pop();
const amplifyLiveUrls = getAwsAmplifyLiveUrls({
id: pullRequest.html_url.split("/"),
id: pullRequestNumber,
labels,
amplifyUri,
});
Expand All @@ -414,7 +426,7 @@ exports.action = async function action() {
? {
[customFieldStorybook.gid]: storybookAmplifyUri.replace(
"%",
pullRequest.html_url.split("/").pop()
pullRequestNumber
),
}
: {}),
Expand Down Expand Up @@ -480,4 +492,4 @@ exports.action = async function action() {
break;
}
}
};
}

0 comments on commit de867eb

Please sign in to comment.