Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
21 changes: 16 additions & 5 deletions dist/actions/autolabeler/run.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import { C as setFailed, D as __toESM, E as __commonJSMin, S as info, T as warning, _ as isAxiosError, b as error, g as context, h as getOctokit, l as object, m as composeConfigGet, o as array, r as sharedInputSchema, t as stringToRegex, u as string, v as axios, w as setOutput, x as getInput } from "../../chunks/common.js";
import * as fs from "node:fs";
//#region src/actions/autolabeler/config/action-input.schema.ts
var actionInputSchema = object({ "config-name": string().optional().default("release-drafter.yml") }).and(sharedInputSchema);
var actionInputSchema = object({
/**
* If your workflow requires multiple release-drafter configs it be helpful to override the config-name.
* The config should still be located inside `.github` as that's where we are looking for config files.
* @default 'release-drafter.yml'
*/
"config-name": string().optional().default("release-drafter.yml") }).and(sharedInputSchema);
//#endregion
//#region src/actions/autolabeler/config/config.schema.ts
var configSchema = object({ autolabeler: array(object({
var configSchema = object({
/**
* You can add automatically a label into a pull request.
* Available matchers are `files` (glob), `branch` (regex), `title` (regex) and `body` (regex).
* Matchers are evaluated independently; the label will be set if at least one of the matchers meets the criteria.
*/
autolabeler: array(object({
label: string().min(1),
files: array(string().min(1)).optional().default([]),
branch: array(string().min(1)).optional().default([]),
Expand Down Expand Up @@ -127,7 +139,6 @@ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
var MODE_IGNORE = "regex";
var MODE_CHECK_IGNORE = "checkRegex";
var UNDERSCORE = "_";
var TRAILING_WILD_CARD_REPLACERS = {
[MODE_IGNORE](_, p1) {
return `${p1 ? `${p1}[^/]+` : "[^/]*"}(?=$|\\/$)`;
Expand All @@ -150,12 +161,12 @@ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
define(this, "regexPrefix", prefix);
}
get regex() {
const key = UNDERSCORE + MODE_IGNORE;
const key = "_regex";
if (this[key]) return this[key];
return this._make(MODE_IGNORE, key);
}
get checkRegex() {
const key = UNDERSCORE + MODE_CHECK_IGNORE;
const key = "_checkRegex";
if (this[key]) return this[key];
return this._make(MODE_CHECK_IGNORE, key);
}
Expand Down
130 changes: 121 additions & 9 deletions dist/actions/drafter/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,69 @@ import * as fs from "node:fs";
* @see merge-input-and-config.ts for how the merging of config and input is handled, including default values.
*/
var commonConfigSchema = object({
/**
* A boolean indicating whether the release being created or updated should be marked as latest.
*/
latest: stringbool().or(boolean()).optional(),
/**
* Whether to draft a prerelease, with changes since another prerelease (if applicable). Default `false`.
*/
prerelease: stringbool().or(boolean()).optional(),
/**
* When drafting your first release, limit the amount of scanned commits. Expects an ISO 8601 date. Default: undefined (scan all commits).
* @see https://zod.dev/api?id=iso-dates#iso-datetimes
*/
"initial-commits-since": datetime().optional(),
/**
* A string indicating an identifier (alpha, beta, rc, etc), to increment the prerelease version. This automatically enables `prerelease` if not already set to `true`. Default `''`.
*/
"prerelease-identifier": string().optional(),
/**
* When looking for the last published release to scan changes up-to, include pre-releases. Has no effect if using `prerelease: true` (already enabled). Default `false`.
*/
"include-pre-releases": stringbool().or(boolean()).optional(),
/**
* The release target, i.e. branch or commit it should point to. Default: the ref that release-drafter runs for, e.g. `refs/heads/master` if configured to run on pushes to `master`.
*/
commitish: string().optional(),
/**
* A string that would be added before the template body.
*/
header: string().optional(),
/**
* A string that would be added after the template body.
*/
footer: string().optional(),
/**
* Filter releases that satisfies this semver range. Evaluates the tag name againts node's semver.satisfies().
*/
"filter-by-range": string().optional()
});
var actionInputSchema = object({
/**
* If your workflow requires multiple release-drafter configs it be helpful to override the config-name.
* The config should still be located inside `.github` as that's where we are looking for config files.
* @default 'release-drafter.yml'
*/
"config-name": string().optional().default("release-drafter.yml"),
/**
* The name that will be used in the GitHub release that's created or updated.
* This will override any `name-template` specified in your `release-drafter.yml` if defined.
*/
name: string().optional(),
/**
* The tag name to be associated with the GitHub release that's created or updated.
* This will override any `tag-template` specified in your `release-drafter.yml` if defined.
*/
tag: string().optional(),
/**
* The version to be associated with the GitHub release that's created or updated.
* This will override any version calculated by the release-drafter.
*/
version: string().optional(),
/**
* A boolean indicating whether the release being created or updated should be immediately published.
*/
publish: stringbool().optional().default(false)
}).and(sharedInputSchema).and(commonConfigSchema);
//#endregion
Expand Down Expand Up @@ -55,34 +103,94 @@ var getActionInput = () => {
//#endregion
//#region src/actions/drafter/config/schemas/config.schema.ts
var exclusiveConfigSchema = object({
/**
* The template to use for each merged pull request.
*/
"change-template": string().optional().default("* $TITLE (#$NUMBER) @$AUTHOR"),
/**
* Characters to escape in `$TITLE` when inserting into `change-template` so that they are not interpreted as Markdown format characters.
*/
"change-title-escapes": string().optional(),
/**
* The template to use for when there’s no changes.
*/
"no-changes-template": string().optional().default("* No changes"),
/**
* The template to use when calculating the next version number for the release. Useful for projects that don't use semantic versioning.
*/
"version-template": string().optional().default("$MAJOR.$MINOR.$PATCH$PRERELEASE"),
/**
* The template for the name of the draft release.
*/
"name-template": string().optional(),
/**
* A known prefix used to filter release tags. For matching tags, this prefix is stripped before attempting to parse the version.
*/
"tag-prefix": string().optional(),
/**
* The template for the tag of the draft release.
*/
"tag-template": string().optional(),
/**
* Exclude pull requests using labels.
*/
"exclude-labels": array(string()).optional().default([]),
/**
* Include only the specified pull requests using labels.
*/
"include-labels": array(string()).optional().default([]),
/**
* Restrict pull requests included in the release notes to only the pull requests that modified any of the paths in this array. Supports files and directories.
*/
"include-paths": array(string()).optional().default([]),
/**
* Exclude pull requests from the release notes if they modified any of the paths in this array. Supports files and directories. If used with `include-paths`, the exclusion takes precedence.
*/
"exclude-paths": array(string()).optional().default([]),
/**
* Exclude specific usernames from the generated `$CONTRIBUTORS` variable.
*/
"exclude-contributors": array(string()).optional().default([]),
/**
* The template to use for `$CONTRIBUTORS` when there's no contributors to list.
*/
"no-contributors-template": string().optional().default("No contributors"),
/**
* Sort changelog by merged_at or title.
*/
"sort-by": _enum(["merged_at", "title"]).optional().default("merged_at"),
/**
* Sort changelog in ascending or descending order.
*/
"sort-direction": _enum(["ascending", "descending"]).optional().default("descending"),
/**
* Filter previous releases to consider only those with the target matching `commitish`.
*/
"filter-by-commitish": boolean().optional().default(false),
"pull-request-limit": number().int().positive().optional().default(5),
/**
* Size of the pagination window when walking the repo. Can avoid erratic 502s from Github. Default: `15`
*/
"history-limit": number().int().positive().optional().default(15),
/**
* Search and replace content in the generated changelog body.
*/
replacers: array(object({
search: string().min(1),
replace: string().min(0)
})).optional().default([]),
/**
* Categorize pull requests using labels.
*/
categories: array(object({
title: string().min(1),
"collapse-after": number().int().min(-1).optional().default(-1),
labels: array(string().min(1)).optional().default([]),
label: string().min(1).optional()
})).optional().default([]),
/**
* Adjust the `$RESOLVED_VERSION` variable using labels.
*/
"version-resolver": object({
major: object({ labels: array(string().min(1)) }).optional().default({ labels: [] }),
minor: object({ labels: array(string().min(1)) }).optional().default({ labels: [] }),
Expand All @@ -98,7 +206,14 @@ var exclusiveConfigSchema = object({
patch: { labels: [] },
default: "patch"
}),
/**
* The template to use for each category.
*/
"category-template": string().optional().default("## $TITLE"),
/**
* The template for the body of the draft release.
* Optional as it may be inherited via `_extends`.
*/
template: string().optional().default("")
}).meta({
title: "JSON schema for Release Drafter yaml files",
Expand Down Expand Up @@ -1114,16 +1229,12 @@ function buildReplaceStringForSpecificSpecialCharacter(matches, pattern, special
}
//#endregion
//#region src/actions/drafter/lib/build-release-payload/render-template/util/replacePattern.ts
var ReplacePatternKind = /* @__PURE__ */ function(ReplacePatternKind) {
ReplacePatternKind[ReplacePatternKind["StaticValue"] = 0] = "StaticValue";
ReplacePatternKind[ReplacePatternKind["DynamicPieces"] = 1] = "DynamicPieces";
return ReplacePatternKind;
}(ReplacePatternKind || {});
/**
* Assigned when the replace pattern is entirely static.
*/
var StaticValueReplacePattern = class {
kind = ReplacePatternKind.StaticValue;
staticValue;
kind = 0;
constructor(staticValue) {
this.staticValue = staticValue;
}
Expand All @@ -1132,7 +1243,8 @@ var StaticValueReplacePattern = class {
* Assigned when the replace pattern has replacement patterns.
*/
var DynamicPiecesReplacePattern = class {
kind = ReplacePatternKind.DynamicPieces;
pieces;
kind = 1;
constructor(pieces) {
this.pieces = pieces;
}
Expand All @@ -1143,15 +1255,15 @@ var ReplacePattern = class ReplacePattern {
}
_state;
get hasReplacementPatterns() {
return this._state.kind === ReplacePatternKind.DynamicPieces;
return this._state.kind === 1;
}
constructor(pieces) {
if (!pieces || pieces.length === 0) this._state = new StaticValueReplacePattern("");
else if (pieces.length === 1 && pieces[0].staticValue !== null) this._state = new StaticValueReplacePattern(pieces[0].staticValue);
else this._state = new DynamicPiecesReplacePattern(pieces);
}
buildReplaceString(matches, preserveCase) {
if (this._state.kind === ReplacePatternKind.StaticValue) if (preserveCase) return buildReplaceStringWithCasePreserved(matches, this._state.staticValue);
if (this._state.kind === 0) if (preserveCase) return buildReplaceStringWithCasePreserved(matches, this._state.staticValue);
else return this._state.staticValue;
let result = "";
for (let i = 0, len = this._state.pieces.length; i < len; i++) {
Expand Down
Loading
Loading