Implement Ignore Tag (#481)
[COMBINE] commits = ["fbd1584e7baed4a3603e3c810066603185f1b230"] [COMBINE]
This commit is contained in:
parent
92edad53ec
commit
5d557b6424
@ -1,5 +1,5 @@
|
|||||||
import { Commit, FixUpInfo, InputReleaseType } from "../../types/changelogTypes";
|
import { Commit, FixUpInfo, InputReleaseType } from "../../types/changelogTypes";
|
||||||
import { getLastGitTag, isEnvVariableSet } from "../../util/util";
|
import { getLastGitTag, getTags, isEnvVariableSet } from "../../util/util";
|
||||||
|
|
||||||
export default class ChangelogData {
|
export default class ChangelogData {
|
||||||
since: string;
|
since: string;
|
||||||
@ -16,7 +16,10 @@ export default class ChangelogData {
|
|||||||
// Map of a commit SHA to the commits which need to be added to its commit list.
|
// Map of a commit SHA to the commits which need to be added to its commit list.
|
||||||
combineList: Map<string, Commit[]>;
|
combineList: Map<string, Commit[]>;
|
||||||
|
|
||||||
constructor() {
|
// Set of tags
|
||||||
|
tags: Set<string>;
|
||||||
|
|
||||||
|
async init(): Promise<void> {
|
||||||
this.since = getLastGitTag();
|
this.since = getLastGitTag();
|
||||||
this.to = "HEAD";
|
this.to = "HEAD";
|
||||||
|
|
||||||
@ -48,5 +51,7 @@ export default class ChangelogData {
|
|||||||
this.commitFixes = new Map<string, FixUpInfo>();
|
this.commitFixes = new Map<string, FixUpInfo>();
|
||||||
this.shaList = new Set<string>();
|
this.shaList = new Set<string>();
|
||||||
this.combineList = new Map<string, Commit[]>();
|
this.combineList = new Map<string, Commit[]>();
|
||||||
|
|
||||||
|
this.tags = new Set<string>(await getTags(this.to));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,10 @@ import pushAll from "./pusher";
|
|||||||
*/
|
*/
|
||||||
async function createChangelog(): Promise<ChangelogData> {
|
async function createChangelog(): Promise<ChangelogData> {
|
||||||
const data: ChangelogData = new ChangelogData();
|
const data: ChangelogData = new ChangelogData();
|
||||||
changelogSetup(data);
|
|
||||||
|
await data.init();
|
||||||
|
categoriesSetup();
|
||||||
|
specialParserSetup(data);
|
||||||
|
|
||||||
for (const parser of parsers) {
|
for (const parser of parsers) {
|
||||||
await parse(data, parser);
|
await parse(data, parser);
|
||||||
@ -29,11 +32,6 @@ async function createChangelog(): Promise<ChangelogData> {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changelogSetup(data: ChangelogData) {
|
|
||||||
categoriesSetup();
|
|
||||||
specialParserSetup(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a changelog based on environment variables, and saves it to the root directory.
|
* Creates a changelog based on environment variables, and saves it to the root directory.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Category, Commit, Parser, SubCategory } from "../../types/changelogTypes";
|
import { Category, Commit, Ignored, Parser, SubCategory } from "../../types/changelogTypes";
|
||||||
import { modpackManifest } from "../../globals";
|
import { modpackManifest } from "../../globals";
|
||||||
import { parseCommitBody } from "./parser";
|
import { parseCommitBody } from "./parser";
|
||||||
import { parseFixUp } from "./specialParser";
|
import { parseFixUp } from "./specialParser";
|
||||||
@ -26,6 +26,7 @@ export const combineKey = "[COMBINE]";
|
|||||||
export const combineList = "commits";
|
export const combineList = "commits";
|
||||||
export const fixUpKey = "[FIXUP]";
|
export const fixUpKey = "[FIXUP]";
|
||||||
export const fixUpList = "fixes";
|
export const fixUpList = "fixes";
|
||||||
|
export const ignoreKey = "[IGNORE]";
|
||||||
|
|
||||||
/* Sub Category Keys */
|
/* Sub Category Keys */
|
||||||
// Mode Category Keys
|
// Mode Category Keys
|
||||||
@ -121,7 +122,7 @@ const defaultParsingCallback = async (
|
|||||||
commit: Commit,
|
commit: Commit,
|
||||||
commitMessage: string,
|
commitMessage: string,
|
||||||
commitBody: string,
|
commitBody: string,
|
||||||
): Promise<boolean> => {
|
): Promise<boolean | Ignored> => {
|
||||||
if (!commitBody) return false;
|
if (!commitBody) return false;
|
||||||
return parseCommitBody(commitMessage, commitBody, commit, parser);
|
return parseCommitBody(commitMessage, commitBody, commit, parser);
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
import { Category, Commit, Parser, SubCategory } from "../../types/changelogTypes";
|
import { Category, Commit, Ignored, Parser, SubCategory } from "../../types/changelogTypes";
|
||||||
import { categories, combineKey, defaultIndentation, detailsKey, expandKey, noCategoryKey } from "./definitions";
|
import {
|
||||||
import { parseCombine, parseDetails, parseExpand } from "./specialParser";
|
categories,
|
||||||
|
combineKey,
|
||||||
|
defaultIndentation,
|
||||||
|
detailsKey,
|
||||||
|
expandKey,
|
||||||
|
ignoreKey,
|
||||||
|
noCategoryKey,
|
||||||
|
} from "./definitions";
|
||||||
|
import { parseCombine, parseDetails, parseExpand, parseIgnore } from "./specialParser";
|
||||||
import { getChangelog } from "../../util/util";
|
import { getChangelog } from "../../util/util";
|
||||||
import ChangelogData from "./changelogData";
|
import ChangelogData from "./changelogData";
|
||||||
|
|
||||||
@ -22,6 +30,12 @@ export default async function parseParser(data: ChangelogData, parser: Parser):
|
|||||||
}
|
}
|
||||||
|
|
||||||
const parsed = await parser.itemCallback(parser, commit, commit.message, commit.body);
|
const parsed = await parser.itemCallback(parser, commit, commit.message, commit.body);
|
||||||
|
if (parsed instanceof Ignored) {
|
||||||
|
if (parsed.getCommitList() && parser.addCommitListCallback) {
|
||||||
|
if (parser.addCommitListCallback(commit, true)) data.commitList.push(commit);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!parsed && parser.leftOverCallback) parser.leftOverCallback(commit, commit.message, commit.body, []);
|
if (!parsed && parser.leftOverCallback) parser.leftOverCallback(commit, commit.message, commit.body, []);
|
||||||
if (!parser.addSHACallback || parser.addSHACallback(commit, parsed)) data.shaList.add(commit.hash);
|
if (!parser.addSHACallback || parser.addSHACallback(commit, parsed)) data.shaList.add(commit.hash);
|
||||||
@ -43,11 +57,17 @@ export async function parseCommitBody(
|
|||||||
commitBody: string,
|
commitBody: string,
|
||||||
commitObject: Commit,
|
commitObject: Commit,
|
||||||
parser: Parser,
|
parser: Parser,
|
||||||
): Promise<boolean> {
|
): Promise<boolean | Ignored> {
|
||||||
if (commitBody.includes(expandKey)) {
|
if (commitBody.includes(expandKey)) {
|
||||||
await parseExpand(commitBody, commitObject, parser);
|
await parseExpand(commitBody, commitObject, parser);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (commitBody.includes(ignoreKey)) {
|
||||||
|
const ignore = await parseIgnore(commitBody, commitObject);
|
||||||
|
|
||||||
|
// Only return if ignore is not undefined
|
||||||
|
if (ignore) return ignore;
|
||||||
|
}
|
||||||
if (commitBody.includes(detailsKey)) {
|
if (commitBody.includes(detailsKey)) {
|
||||||
await parseDetails(commitMessage, commitBody, commitObject, parser);
|
await parseDetails(commitMessage, commitBody, commitObject, parser);
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,19 +35,17 @@ export default function pushAll(inputData: ChangelogData): void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Push the commit log
|
// Push the commit log
|
||||||
if (data.commitList) {
|
if (data.commitList.length > 0) {
|
||||||
sortCommitList(data.commitList, (commit) => commit);
|
sortCommitList(data.commitList, (commit) => commit);
|
||||||
|
|
||||||
data.builder.push("## Commits");
|
data.builder.push("## Commits");
|
||||||
data.commitList.forEach((commit) => {
|
data.commitList.forEach((commit) => {
|
||||||
data.builder.push(formatCommit(commit));
|
data.builder.push(formatCommit(commit));
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
|
// No Commit List = No Changes
|
||||||
// Check if the builder only contains the title.
|
|
||||||
if (data.builder.length <= 3) {
|
|
||||||
data.builder.push("");
|
data.builder.push("");
|
||||||
data.builder.push("There haven't been any changes.");
|
data.builder.push("**There haven't been any changes.**");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push link
|
// Push link
|
||||||
@ -133,7 +131,7 @@ function sortCommitList<T>(list: T[], transform: (obj: T) => Commit | undefined,
|
|||||||
* Sorts a commits list so that newest commits are on the bottom.
|
* Sorts a commits list so that newest commits are on the bottom.
|
||||||
* @param list The commit list.
|
* @param list The commit list.
|
||||||
*/
|
*/
|
||||||
export function sortCommitListReverse(list: Commit[]) {
|
export function sortCommitListReverse(list: Commit[]): void {
|
||||||
list.sort((a, b) => {
|
list.sort((a, b) => {
|
||||||
const dateA = new Date(a.date);
|
const dateA = new Date(a.date);
|
||||||
const dateB = new Date(b.date);
|
const dateB = new Date(b.date);
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
import { ChangelogMessage, Commit, ExpandedMessage, FixUpInfo, Parser } from "../../types/changelogTypes";
|
import {
|
||||||
|
ChangelogMessage,
|
||||||
|
Commit,
|
||||||
|
ExpandedMessage,
|
||||||
|
FixUpInfo,
|
||||||
|
Ignored,
|
||||||
|
IgnoreInfo,
|
||||||
|
Parser,
|
||||||
|
} from "../../types/changelogTypes";
|
||||||
import dedent from "dedent-js";
|
import dedent from "dedent-js";
|
||||||
import matter, { GrayMatterFile } from "gray-matter";
|
import matter, { GrayMatterFile } from "gray-matter";
|
||||||
import toml from "@ltd/j-toml";
|
import toml from "@ltd/j-toml";
|
||||||
@ -11,6 +19,7 @@ import {
|
|||||||
expandList,
|
expandList,
|
||||||
fixUpKey,
|
fixUpKey,
|
||||||
fixUpList,
|
fixUpList,
|
||||||
|
ignoreKey,
|
||||||
indentationLevel,
|
indentationLevel,
|
||||||
} from "./definitions";
|
} from "./definitions";
|
||||||
import { findCategories, findSubCategory } from "./parser";
|
import { findCategories, findSubCategory } from "./parser";
|
||||||
@ -22,12 +31,46 @@ export function specialParserSetup(inputData: ChangelogData): void {
|
|||||||
data = inputData;
|
data = inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks a commit's ignore.
|
||||||
|
* @commit The Commit Body. Does check whether the ignore key is there.
|
||||||
|
* @return Returns undefined to continue, and an Ignored object if to skip.
|
||||||
|
*/
|
||||||
|
export async function parseIgnore(commitBody: string, commitObject: Commit): Promise<Ignored | undefined> {
|
||||||
|
if (!commitBody.includes(ignoreKey)) return undefined;
|
||||||
|
const info = await parseTOML<IgnoreInfo>(commitBody, commitObject, ignoreKey);
|
||||||
|
if (!info) return undefined;
|
||||||
|
if (!info.before && !info.after) {
|
||||||
|
console.error(dedent`
|
||||||
|
Ignore Info in body:
|
||||||
|
\`\`\`
|
||||||
|
${commitBody}\`\`\`
|
||||||
|
of commit object ${commitObject.hash} (${commitObject.message}) is missing both keys 'before' and 'after'!
|
||||||
|
At least one of these values must be set!`);
|
||||||
|
if (data.isTest) throw new Error("Failed Parsing Ignore Info. See Above.");
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isBefore = undefined,
|
||||||
|
isAfter = undefined;
|
||||||
|
|
||||||
|
if (info.before) isBefore = !data.tags.has(info.before);
|
||||||
|
if (info.after) isAfter = data.tags.has(info.after);
|
||||||
|
|
||||||
|
// Return Ignores
|
||||||
|
if (isBefore === undefined || isAfter === undefined) {
|
||||||
|
if (isBefore || isAfter) return new Ignored(info.addCommitList);
|
||||||
|
} else if (isBefore && isAfter) return new Ignored(info.addCommitList);
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a commit with 'Fixup'.
|
* Parses a commit with 'Fixup'.
|
||||||
*/
|
*/
|
||||||
export async function parseFixUp(commit: Commit): Promise<boolean> {
|
export async function parseFixUp(commit: Commit): Promise<boolean> {
|
||||||
if (!commit.body || !commit.body.includes(fixUpKey)) return false;
|
if (!commit.body || !commit.body.includes(fixUpKey)) return false;
|
||||||
await parse(
|
await parseTOMLToList(
|
||||||
commit.body,
|
commit.body,
|
||||||
commit,
|
commit,
|
||||||
fixUpKey,
|
fixUpKey,
|
||||||
@ -54,7 +97,7 @@ export async function parseFixUp(commit: Commit): Promise<boolean> {
|
|||||||
* Parses a commit with 'expand'.
|
* Parses a commit with 'expand'.
|
||||||
*/
|
*/
|
||||||
export async function parseExpand(commitBody: string, commitObject: Commit, parser: Parser): Promise<void> {
|
export async function parseExpand(commitBody: string, commitObject: Commit, parser: Parser): Promise<void> {
|
||||||
await parse(
|
await parseTOMLToList(
|
||||||
commitBody,
|
commitBody,
|
||||||
commitObject,
|
commitObject,
|
||||||
expandKey,
|
expandKey,
|
||||||
@ -117,7 +160,7 @@ async function expandDetailsLevel(
|
|||||||
indentation = indentationLevel,
|
indentation = indentationLevel,
|
||||||
): Promise<ChangelogMessage[]> {
|
): Promise<ChangelogMessage[]> {
|
||||||
const result: ChangelogMessage[] = [];
|
const result: ChangelogMessage[] = [];
|
||||||
await parse(
|
await parseTOMLToList(
|
||||||
commitBody,
|
commitBody,
|
||||||
commitObject,
|
commitObject,
|
||||||
detailsKey,
|
detailsKey,
|
||||||
@ -139,7 +182,7 @@ async function expandDetailsLevel(
|
|||||||
* Parses a commit with 'combine'.
|
* Parses a commit with 'combine'.
|
||||||
*/
|
*/
|
||||||
export async function parseCombine(commitBody: string, commitObject: Commit): Promise<void> {
|
export async function parseCombine(commitBody: string, commitObject: Commit): Promise<void> {
|
||||||
await parse(
|
await parseTOMLToList(
|
||||||
commitBody,
|
commitBody,
|
||||||
commitObject,
|
commitObject,
|
||||||
combineKey,
|
combineKey,
|
||||||
@ -153,32 +196,23 @@ export async function parseCombine(commitBody: string, commitObject: Commit): Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse TOML in a commit body to produce a list.
|
* Parse TOML in a commit body.
|
||||||
* @param commitBody The body to parse
|
* @param commitBody The body to parse
|
||||||
* @param commitObject The commit object to grab messages from, and to determine error messages.
|
* @param commitObject The commit object to grab messages from, and to determine error messages.
|
||||||
* @param delimiter The delimiters, surrounding the TOML.
|
* @param delimiter The delimiters, surrounding the TOML.
|
||||||
* @param listKey The key of the list to parse.
|
* @param itemKey The key of the item to parse. If not set, will just parse the main object.
|
||||||
* @param emptyCheck The check to see if an item in the list is invalid.
|
|
||||||
* @param perItemCallback The callback to perform on each item in the list.
|
|
||||||
* @param matterCallback An optional callback to perform on the matter.
|
* @param matterCallback An optional callback to perform on the matter.
|
||||||
|
* @returns item The Item/Object. Undefined if error.
|
||||||
*/
|
*/
|
||||||
async function parse<T>(
|
async function parseTOML<T>(
|
||||||
commitBody: string,
|
commitBody: string,
|
||||||
commitObject: Commit,
|
commitObject: Commit,
|
||||||
delimiter: string,
|
delimiter: string,
|
||||||
listKey: string,
|
itemKey?: string,
|
||||||
emptyCheck: (item: T) => string,
|
|
||||||
perItemCallback: (item: T) => void,
|
|
||||||
matterCallback?: (matter: GrayMatterFile<string>) => void,
|
matterCallback?: (matter: GrayMatterFile<string>) => void,
|
||||||
): Promise<void> {
|
): Promise<T | undefined> {
|
||||||
let messages: T[];
|
let item: T;
|
||||||
let endMessage = "Skipping...";
|
const endMessage = getEndMessage(delimiter);
|
||||||
|
|
||||||
if (data.isTest) {
|
|
||||||
endMessage = dedent`
|
|
||||||
Try checking the TOML syntax in https://www.toml-lint.com/, checking the object tree in https://www.convertsimple.com/convert-toml-to-json/, checking syntax in https://toml.io/en/v1.0.0, and looking through https://github.com/Nomi-CEu/Nomi-CEu/blob/main/CONTRIBUTING.md!
|
|
||||||
Also check that you have surrounded the TOML in '${delimiter}'!`;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Remove everything before first delimiter in body
|
// Remove everything before first delimiter in body
|
||||||
@ -200,14 +234,15 @@ async function parse<T>(
|
|||||||
|
|
||||||
if (matterCallback) matterCallback(parseResult);
|
if (matterCallback) matterCallback(parseResult);
|
||||||
|
|
||||||
messages = parseResult.data[listKey];
|
if (!itemKey) item = parseResult.data as T;
|
||||||
|
else item = parseResult.data[itemKey];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(dedent`
|
console.error(dedent`
|
||||||
Failed parsing TOML in body:
|
Failed parsing TOML in body:
|
||||||
\`\`\`
|
\`\`\`
|
||||||
${commitBody}\`\`\`
|
${commitBody}\`\`\`
|
||||||
of commit object ${commitObject.hash} (${commitObject.message}).
|
of commit object ${commitObject.hash} (${commitObject.message}).
|
||||||
This could be because of invalid syntax, or because the Message List (key: '${listKey}') is not an array.`);
|
This could be because of invalid syntax.`);
|
||||||
|
|
||||||
if (commitObject.body && commitBody !== commitObject.body) {
|
if (commitObject.body && commitBody !== commitObject.body) {
|
||||||
console.error(dedent`
|
console.error(dedent`
|
||||||
@ -218,9 +253,34 @@ async function parse<T>(
|
|||||||
|
|
||||||
console.error(`\n${endMessage}\n`);
|
console.error(`\n${endMessage}\n`);
|
||||||
if (data.isTest) throw e;
|
if (data.isTest) throw e;
|
||||||
return;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse TOML in a commit body to produce a list.
|
||||||
|
* @param commitBody The body to parse
|
||||||
|
* @param commitObject The commit object to grab messages from, and to determine error messages.
|
||||||
|
* @param delimiter The delimiters, surrounding the TOML.
|
||||||
|
* @param listKey The key of the list to parse.
|
||||||
|
* @param emptyCheck The check to see if an item in the list is invalid.
|
||||||
|
* @param perItemCallback The callback to perform on each item in the list.
|
||||||
|
* @param matterCallback An optional callback to perform on the matter.
|
||||||
|
*/
|
||||||
|
async function parseTOMLToList<T>(
|
||||||
|
commitBody: string,
|
||||||
|
commitObject: Commit,
|
||||||
|
delimiter: string,
|
||||||
|
listKey: string,
|
||||||
|
emptyCheck: (item: T) => string,
|
||||||
|
perItemCallback: (item: T) => void,
|
||||||
|
matterCallback?: (matter: GrayMatterFile<string>) => void,
|
||||||
|
): Promise<void> {
|
||||||
|
const messages = await parseTOML<T[]>(commitBody, commitObject, delimiter, listKey, matterCallback);
|
||||||
|
const endMessage = getEndMessage(delimiter);
|
||||||
|
|
||||||
if (!messages || !Array.isArray(messages) || messages.length === 0) {
|
if (!messages || !Array.isArray(messages) || messages.length === 0) {
|
||||||
console.error(dedent`
|
console.error(dedent`
|
||||||
List (key: '${listKey}') in body:
|
List (key: '${listKey}') in body:
|
||||||
@ -262,3 +322,12 @@ async function parse<T>(
|
|||||||
perItemCallback(item);
|
perItemCallback(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEndMessage(delimiter: string) {
|
||||||
|
if (data.isTest) {
|
||||||
|
return dedent`
|
||||||
|
Try checking the TOML syntax in https://www.toml-lint.com/, checking the object tree in https://www.convertsimple.com/convert-toml-to-json/, checking syntax in https://toml.io/en/v1.0.0, and looking through https://github.com/Nomi-CEu/Nomi-CEu/blob/main/CONTRIBUTING.md!
|
||||||
|
Also check that you have surrounded the TOML in '${delimiter}'!`;
|
||||||
|
}
|
||||||
|
return "Skipping...";
|
||||||
|
}
|
||||||
|
@ -159,9 +159,14 @@ export interface Parser {
|
|||||||
* commit: The commit object.
|
* commit: The commit object.
|
||||||
* commitMessage: The message of the commit.<p>
|
* commitMessage: The message of the commit.<p>
|
||||||
* commitBody: The body of the commit. Might be undefined.<p>
|
* commitBody: The body of the commit. Might be undefined.<p>
|
||||||
* return: True if parsing was successful, false if not.
|
* return: True if parsing was successful, false if not. Can return Ignored if commit was ignored (not skipped).
|
||||||
*/
|
*/
|
||||||
itemCallback: (parser: Parser, commit: Commit, commitMessage: string, commitBody?: string) => Promise<boolean>;
|
itemCallback: (
|
||||||
|
parser: Parser,
|
||||||
|
commit: Commit,
|
||||||
|
commitMessage: string,
|
||||||
|
commitBody?: string,
|
||||||
|
) => Promise<boolean | Ignored>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The callback to perform on any commits, which did not pass parsing. If not set, no callback will be performed, and those commits will be discarded.
|
* The callback to perform on any commits, which did not pass parsing. If not set, no callback will be performed, and those commits will be discarded.
|
||||||
@ -199,6 +204,25 @@ export interface Parser {
|
|||||||
addCommitListCallback: (commit: Commit, parsed: boolean) => boolean;
|
addCommitListCallback: (commit: Commit, parsed: boolean) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IgnoreInfo {
|
||||||
|
before?: string;
|
||||||
|
after?: string;
|
||||||
|
addCommitList?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Ignored {
|
||||||
|
private readonly addCommitList: boolean | undefined;
|
||||||
|
|
||||||
|
constructor(addCommitList?: boolean) {
|
||||||
|
this.addCommitList = addCommitList;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCommitList(): boolean {
|
||||||
|
if (this.addCommitList === undefined) return false;
|
||||||
|
return this.addCommitList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface ModChangeInfo {
|
export interface ModChangeInfo {
|
||||||
modName: string;
|
modName: string;
|
||||||
projectID?: number;
|
projectID?: number;
|
||||||
|
@ -255,6 +255,17 @@ export async function getChangelog(since = "HEAD", to = "HEAD", dirs: string[] =
|
|||||||
return commitList;
|
return commitList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list of tags that are at or before a certain ref point.
|
||||||
|
* @param ref The ref point. Can be a tag or a commit sha. If not set, defaults to HEAD.
|
||||||
|
* @returns tags An array of all the tags
|
||||||
|
*/
|
||||||
|
export async function getTags(ref = "HEAD"): Promise<string[]> {
|
||||||
|
const options: string[] = ["--merged", ref];
|
||||||
|
const test = await git.tags(options);
|
||||||
|
return test.all;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the file at a certain point in time.
|
* Gets the file at a certain point in time.
|
||||||
* @param path The path to the file
|
* @param path The path to the file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user