Skip to content

Commit

Permalink
feat: add linear previews links [DEVOP-330] (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach authored Nov 13, 2024
1 parent 185a002 commit 7736d93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/actions/amplify.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ exports.getAmplifyURIs = async function getAmplifyURI() {
);

if (hasAtLeastOnePackageOrConfig) {
return { links: Object.values(amplifyUris) };
return {
links: Object.entries(amplifyUris).reduce((acc, [label, url]) => {
return { ...acc, label, url };
}, {}),
};
}

const links = [];
const hiddenLinks = [];
for (const label of labels) {
if (amplifyUris[label]) {
links.push(amplifyUris[label]);
links.push({ label, url: amplifyUris[label] });
}
}
for (const [key, url] of Object.entries(amplifyUris)) {
Expand Down
4 changes: 3 additions & 1 deletion lib/actions/pullRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ exports.validatePR = async function validatePR({ pullRequest, issue }) {
const body =
"AWS Amplify live test URI:\n" +
"- " +
amplifyUris.join("\n- ") +
amplifyUris
.map((elt) => `[${elt.label?.split("/")?.pop()} preview](${elt.url})`)
.join("\n- ") +
hiddenAmplifyText;
const previousComments = comments.filter(({ body }) =>
body.match(/AWS Amplify live/)
Expand Down

0 comments on commit 7736d93

Please sign in to comment.