Files
twenty/packages/twenty-website/src/github/github-releases/fetch-and-save-github-releases.tsx
T
Félix MalfaitandGitHub 033bedde0a Upgrade NX (#13758)
Upgrade from NX18 to NX21
2025-08-08 10:38:12 +02:00

27 lines
730 B
TypeScript

import { type graphql } from '@octokit/graphql';
import { insertMany } from '@/database/database';
import { githubReleasesModel } from '@/database/model';
import { type Repository } from '@/github/contributors/types';
export const fetchAndSaveGithubReleases = async (
query: typeof graphql,
): Promise<void> => {
const { repository } = await query<Repository>(`
query {
repository(owner: "twentyhq", name: "twenty") {
releases(first: 100) {
nodes {
tagName
publishedAt
}
}
}
}
`);
await insertMany(githubReleasesModel, repository.releases.nodes, {
onConflictKey: 'tagName',
});
};