Bump to core-3.0.0, move to vitest, support ESM modules (#587)

This commit is contained in:
Nick Cipollo
2026-02-01 17:51:43 -05:00
committed by GitHub
parent 5b3313d377
commit 3f973430f2
36 changed files with 36195 additions and 11507 deletions

View File

@@ -1,18 +1,18 @@
import * as core from "@actions/core"
import type { ActionSkipper } from "./ActionSkipper"
import type { ArtifactDestroyer } from "./ArtifactDestroyer"
import type { ArtifactUploader } from "./ArtifactUploader"
import { GithubError } from "./GithubError"
import type { Inputs } from "./Inputs"
import type { Outputs } from "./Outputs"
import { ReleaseValidator } from "./ReleaseValidator"
import type { ActionSkipper } from "./ActionSkipper.js"
import type { ArtifactDestroyer } from "./ArtifactDestroyer.js"
import type { ArtifactUploader } from "./ArtifactUploader.js"
import { GithubError } from "./GithubError.js"
import type { Inputs } from "./Inputs.js"
import type { Outputs } from "./Outputs.js"
import { ReleaseValidator } from "./ReleaseValidator.js"
import type {
CreateOrUpdateReleaseResponse,
CreateReleaseResponse,
ReleaseByTagResponse,
Releases,
UpdateReleaseResponse,
} from "./Releases"
} from "./Releases.js"
export class Action {
private inputs: Inputs

View File

@@ -1,4 +1,4 @@
import { Releases } from "./Releases"
import { Releases } from "./Releases.js"
export interface ActionSkipper {
shouldSkip(): Promise<boolean>

View File

@@ -1,4 +1,4 @@
import { Releases } from "./Releases"
import { Releases } from "./Releases.js"
import * as core from "@actions/core"
export interface ArtifactDestroyer {

View File

@@ -1,9 +1,9 @@
import * as core from "@actions/core"
import { Globber, FileGlobber } from "./Globber"
import { Artifact } from "./Artifact"
import { expandTilde } from "./PathExpander"
import { ArtifactPathValidator } from "./ArtifactPathValidator"
import { PathNormalizer } from "./PathNormalizer"
import { Globber, FileGlobber } from "./Globber.js"
import { Artifact } from "./Artifact.js"
import { expandTilde } from "./PathExpander.js"
import { ArtifactPathValidator } from "./ArtifactPathValidator.js"
import { PathNormalizer } from "./PathNormalizer.js"
export interface ArtifactGlobber {
globArtifactString(artifact: string, contentType: string, errorsFailBuild: boolean): Artifact[]

View File

@@ -1,6 +1,6 @@
import * as core from "@actions/core"
import { Artifact } from "./Artifact"
import { Releases } from "./Releases"
import { Artifact } from "./Artifact.js"
import { Releases } from "./Releases.js"
export interface ArtifactUploader {
uploadArtifacts(artifacts: Artifact[], releaseId: number, uploadUrl: string): Promise<Record<string, string>>

View File

@@ -1,4 +1,4 @@
import { GithubErrorDetail } from "./GithubErrorDetail"
import { GithubErrorDetail } from "./GithubErrorDetail.js"
export class GithubError {
private error: any

View File

@@ -1,8 +1,8 @@
import { readFileSync } from "node:fs"
import * as core from "@actions/core"
import { Context } from "@actions/github/lib/context"
import { readFileSync } from "fs"
import { ArtifactGlobber } from "./ArtifactGlobber"
import { Artifact } from "./Artifact"
import type * as github from "@actions/github"
import type { Artifact } from "./Artifact.js"
import type { ArtifactGlobber } from "./ArtifactGlobber.js"
export interface Inputs {
readonly allowUpdates: boolean
@@ -35,16 +35,16 @@ export interface Inputs {
export class CoreInputs implements Inputs {
private artifactGlobber: ArtifactGlobber
private context: Context
private context: typeof github.context
constructor(artifactGlobber: ArtifactGlobber, context: Context) {
constructor(artifactGlobber: ArtifactGlobber, context: typeof github.context) {
this.artifactGlobber = artifactGlobber
this.context = context
}
get allowUpdates(): boolean {
const allow = core.getInput("allowUpdates")
return allow == "true"
return allow === "true"
}
get artifacts(): Artifact[] {
@@ -64,7 +64,7 @@ export class CoreInputs implements Inputs {
get artifactErrorsFailBuild(): boolean {
const allow = core.getInput("artifactErrorsFailBuild")
return allow == "true"
return allow === "true"
}
private get body(): string | undefined {
@@ -83,12 +83,12 @@ export class CoreInputs implements Inputs {
get createdDraft(): boolean {
const draft = core.getInput("draft")
return draft == "true"
return draft === "true"
}
get createdPrerelease(): boolean {
const preRelease = core.getInput("prerelease")
return preRelease == "true"
return preRelease === "true"
}
get createdReleaseBody(): string | undefined {
@@ -97,7 +97,7 @@ export class CoreInputs implements Inputs {
}
private static get omitBody(): boolean {
return core.getInput("omitBody") == "true"
return core.getInput("omitBody") === "true"
}
get createdReleaseName(): string | undefined {
@@ -106,7 +106,7 @@ export class CoreInputs implements Inputs {
}
private static get omitName(): boolean {
return core.getInput("omitName") == "true"
return core.getInput("omitName") === "true"
}
get commit(): string | undefined {
@@ -136,7 +136,7 @@ export class CoreInputs implements Inputs {
get generateReleaseNotes(): boolean {
const generate = core.getInput("generateReleaseNotes")
return generate == "true"
return generate === "true"
}
get generateReleaseNotesPreviousTag(): string | undefined {
@@ -146,12 +146,12 @@ export class CoreInputs implements Inputs {
get immutableCreate(): boolean {
const immutable = core.getInput("immutableCreate")
return immutable == "true"
return immutable === "true"
}
get makeLatest(): "legacy" | "true" | "false" | undefined {
let latest = core.getInput("makeLatest")
if (latest == "true" || latest == "false" || latest == "legacy") {
const latest = core.getInput("makeLatest")
if (latest === "true" || latest === "false" || latest === "legacy") {
return latest
}
@@ -159,7 +159,7 @@ export class CoreInputs implements Inputs {
}
get owner(): string {
let owner = core.getInput("owner")
const owner = core.getInput("owner")
if (owner) {
return owner
}
@@ -168,16 +168,16 @@ export class CoreInputs implements Inputs {
get removeArtifacts(): boolean {
const removes = core.getInput("removeArtifacts")
return removes == "true"
return removes === "true"
}
get replacesArtifacts(): boolean {
const replaces = core.getInput("replacesArtifacts")
return replaces == "true"
return replaces === "true"
}
get repo(): string {
let repo = core.getInput("repo")
const repo = core.getInput("repo")
if (repo) {
return repo
}
@@ -196,7 +196,7 @@ export class CoreInputs implements Inputs {
const ref = this.context.ref
const tagPath = "refs/tags/"
if (ref && ref.startsWith(tagPath)) {
if (ref?.startsWith(tagPath)) {
return ref.substr(tagPath.length, ref.length)
}
@@ -213,7 +213,7 @@ export class CoreInputs implements Inputs {
}
private static get omitDraftDuringUpdate(): boolean {
return core.getInput("omitDraftDuringUpdate") == "true"
return core.getInput("omitDraftDuringUpdate") === "true"
}
get updatedPrerelease(): boolean | undefined {
@@ -222,7 +222,7 @@ export class CoreInputs implements Inputs {
}
private static get omitPrereleaseDuringUpdate(): boolean {
return core.getInput("omitPrereleaseDuringUpdate") == "true"
return core.getInput("omitPrereleaseDuringUpdate") === "true"
}
get updatedReleaseBody(): string | undefined {
@@ -231,7 +231,7 @@ export class CoreInputs implements Inputs {
}
get updateOnlyUnreleased(): boolean {
return core.getInput("updateOnlyUnreleased") == "true"
return core.getInput("updateOnlyUnreleased") === "true"
}
get updatedReleaseName(): string | undefined {
@@ -240,7 +240,7 @@ export class CoreInputs implements Inputs {
}
private static get omitBodyDuringUpdate(): boolean {
return core.getInput("omitBodyDuringUpdate") == "true"
return core.getInput("omitBodyDuringUpdate") === "true"
}
get omitBodyDuringUpdate(): boolean {
@@ -248,7 +248,7 @@ export class CoreInputs implements Inputs {
}
private static get omitNameDuringUpdate(): boolean {
return core.getInput("omitNameDuringUpdate") == "true"
return core.getInput("omitNameDuringUpdate") === "true"
}
stringFromFile(path: string): string {

View File

@@ -1,14 +1,14 @@
import * as github from "@actions/github"
import * as core from "@actions/core"
import { CoreInputs } from "./Inputs"
import { GithubReleases } from "./Releases"
import { Action } from "./Action"
import { GithubArtifactUploader } from "./ArtifactUploader"
import { FileArtifactGlobber } from "./ArtifactGlobber"
import { GithubError } from "./GithubError"
import { CoreOutputs } from "./Outputs"
import { GithubArtifactDestroyer } from "./ArtifactDestroyer"
import { ActionSkipper, ReleaseActionSkipper } from "./ActionSkipper"
import { CoreInputs } from "./Inputs.js"
import { GithubReleases } from "./Releases.js"
import { Action } from "./Action.js"
import { GithubArtifactUploader } from "./ArtifactUploader.js"
import { FileArtifactGlobber } from "./ArtifactGlobber.js"
import { GithubError } from "./GithubError.js"
import { CoreOutputs } from "./Outputs.js"
import { GithubArtifactDestroyer } from "./ArtifactDestroyer.js"
import { ActionSkipper, ReleaseActionSkipper } from "./ActionSkipper.js"
async function run() {
try {

View File

@@ -1,5 +1,5 @@
import * as core from "@actions/core"
import { ReleaseData } from "./Releases"
import { ReleaseData } from "./Releases.js"
export interface Outputs {
applyReleaseData(releaseData: ReleaseData): void

View File

@@ -1,7 +1,7 @@
import type { GitHub } from "@actions/github/lib/utils"
import * as github from "@actions/github"
import type { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods"
import type { OctokitResponse } from "@octokit/types"
import type { Inputs } from "./Inputs"
import type { Inputs } from "./Inputs.js"
export type CreateReleaseResponse = RestEndpointMethodTypes["repos"]["createRelease"]["response"]
export type ReleaseByTagResponse = RestEndpointMethodTypes["repos"]["getReleaseByTag"]["response"]
@@ -65,10 +65,10 @@ export interface Releases {
}
export class GithubReleases implements Releases {
git: InstanceType<typeof GitHub>
git: ReturnType<typeof github.getOctokit>
inputs: Inputs
constructor(inputs: Inputs, git: InstanceType<typeof GitHub>) {
constructor(inputs: Inputs, git: ReturnType<typeof github.getOctokit>) {
this.inputs = inputs
this.git = git
}