first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

42
node_modules/release-it/lib/plugin/github/util.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
// Totally much borrowed from https://github.com/semantic-release/github/blob/master/lib/success.js
import issueParser from 'issue-parser';
/** @internal */
export const getSearchQueries = (base, commits, separator = '+') => {
const encodedSeparator = encodeURIComponent(separator);
return commits.reduce((searches, commit) => {
const lastSearch = searches[searches.length - 1];
if (lastSearch && encodeURIComponent(lastSearch).length + commit.length <= 256 - encodedSeparator.length) {
searches[searches.length - 1] = `${lastSearch}${separator}${commit}`;
} else {
searches.push(`${base}${separator}${commit}`);
}
return searches;
}, []);
};
export const searchQueries = (client, owner, repo, shas) =>
getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map(
async q => (await client.search.issuesAndPullRequests({ q, advanced_search: true })).data.items
);
export const getCommitsFromChangelog = changelog => {
const regex = /\(([a-f0-9]{7,})\)/i;
return changelog.split('\n').flatMap(message => {
const match = message.match(regex);
if (match) return match[1];
return [];
});
};
export const getResolvedIssuesFromChangelog = (host, owner, repo, changelog) => {
const parser = issueParser('github', { hosts: [host] });
return changelog
.split('\n')
.map(parser)
.flatMap(parsed => parsed.actions.close)
.filter(action => !action.slug || action.slug === `${owner}/${repo}`)
.map(action => ({ type: 'issue', number: parseInt(action.issue, 10) }));
};