Smart changelog (#5205)

Added a smart Changelog :

- Publish the Changelog before the app release. If the release has not
yet been pushed to production, do not display it.
- When the app release is done, make the Changelog available with the
correct date.
- If the Changelog writing is delayed because the release has already
been made, publish it immediately.
- Display everything locally to be able to iterate on the changelog and
have a preview

Added an endpoint for the Changelog

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
Ady Beraud
2024-05-01 09:35:11 +03:00
committed by GitHub
parent bf7c4a5a89
commit df5cb9a904
17 changed files with 232 additions and 11 deletions

View File

@ -68,12 +68,24 @@ export interface Stargazers {
totalCount: number;
}
export interface Releases {
nodes: ReleaseNode[];
}
export interface ReleaseNode {
tagName: string;
name: string;
description: string;
publishedAt: string;
}
export interface Repository {
repository: {
pullRequests: PullRequests;
issues: Issues;
assignableUsers: AssignableUsers;
stargazers: Stargazers;
releases: Releases;
};
}

View File

@ -6,6 +6,7 @@ import { fetchIssuesPRs } from '@/github-sync/contributors/fetch-issues-prs';
import { saveIssuesToDB } from '@/github-sync/contributors/save-issues-to-db';
import { savePRsToDB } from '@/github-sync/contributors/save-prs-to-db';
import { IssueNode, PullRequestNode } from '@/github-sync/contributors/types';
import { fetchAndSaveGithubReleases } from '@/github-sync/github-releases/fetch-and-save-github-releases';
import { fetchAndSaveGithubStars } from '@/github-sync/github-stars/fetch-and-save-github-stars';
export const fetchAndSaveGithubData = async () => {
@ -22,6 +23,7 @@ export const fetchAndSaveGithubData = async () => {
});
await fetchAndSaveGithubStars(query);
await fetchAndSaveGithubReleases(query);
const assignableUsers = await fetchAssignableUsers(query);
const fetchedPRs = (await fetchIssuesPRs(

View File

@ -0,0 +1,26 @@
import { graphql } from '@octokit/graphql';
import { insertMany } from '@/database/database';
import { githubReleasesModel } from '@/database/model';
import { Repository } from '@/github-sync/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',
});
};