Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrations update #1315

Merged
merged 5 commits into from
Nov 6, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion scripts/update-integrations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ async function unsafeUpdateAllIntegrations() {
const details = await fetchWithOverrides(data.name, false);
if (!details) return;

// check if the homepageurl is valid
// if not, replace it by the link to the package on npm
try {
const response = await fetch(details.homepageUrl, { method: 'HEAD'})
if (response.status === 404) {
pascal-brand38 marked this conversation as resolved.
Show resolved Hide resolved
details.homepageUrl = `https://www.npmjs.com/package/${data.name}`
}
} catch (error) {
// such an error may occur when the hostname is unknown
// we consider it ok at this may come from a down server
console.info(`Package ${details.name}: Cannot access ${details.homepageUrl} (not fixed)`)
pascal-brand38 marked this conversation as resolved.
Show resolved Hide resolved
}

const frontmatter = yaml.stringify({
...data,
...details,
Expand Down Expand Up @@ -224,7 +237,7 @@ ${frontmatter}---\n`,

const args = process.argv.slice(2);

// only fetch unsafe changes like new and deprecated integrations
// only fetch unsafe changes like new and deprecated integrations, and fix 404 homepageurl
// if the --unsafe CLI flag was provided
if (args.includes('--unsafe')) {
await unsafeUpdateAllIntegrations();
Expand Down