Add biome and initial format rules

This commit is contained in:
Nick Cipollo
2025-02-17 16:15:54 -05:00
parent 33bf18d283
commit 17b559883e
37 changed files with 3110 additions and 975 deletions

View File

@@ -1,8 +1,8 @@
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 * as core from "@actions/core"
import { Context } from "@actions/github/lib/context"
import { readFileSync } from "fs"
import { ArtifactGlobber } from "./ArtifactGlobber"
import { Artifact } from "./Artifact"
export interface Inputs {
readonly allowUpdates: boolean
@@ -40,53 +40,52 @@ export class CoreInputs implements Inputs {
}
get allowUpdates(): boolean {
const allow = core.getInput('allowUpdates')
return allow == 'true'
const allow = core.getInput("allowUpdates")
return allow == "true"
}
get artifacts(): Artifact[] {
let artifacts = core.getInput('artifacts')
let artifacts = core.getInput("artifacts")
if (!artifacts) {
artifacts = core.getInput('artifact')
artifacts = core.getInput("artifact")
}
if (artifacts) {
let contentType = core.getInput('artifactContentType')
let contentType = core.getInput("artifactContentType")
if (!contentType) {
contentType = 'raw'
contentType = "raw"
}
return this.artifactGlobber
.globArtifactString(artifacts, contentType, this.artifactErrorsFailBuild)
return this.artifactGlobber.globArtifactString(artifacts, contentType, this.artifactErrorsFailBuild)
}
return []
}
get artifactErrorsFailBuild(): boolean {
const allow = core.getInput('artifactErrorsFailBuild')
return allow == 'true'
const allow = core.getInput("artifactErrorsFailBuild")
return allow == "true"
}
private get body(): string | undefined {
const body = core.getInput('body')
const body = core.getInput("body")
if (body) {
return body
}
const bodyFile = core.getInput('bodyFile')
const bodyFile = core.getInput("bodyFile")
if (bodyFile) {
return this.stringFromFile(bodyFile)
}
return ''
return ""
}
get createdDraft(): boolean {
const draft = core.getInput('draft')
return draft == 'true'
const draft = core.getInput("draft")
return draft == "true"
}
get createdPrerelease(): boolean {
const preRelease = core.getInput('prerelease')
return preRelease == 'true'
const preRelease = core.getInput("prerelease")
return preRelease == "true"
}
get createdReleaseBody(): string | undefined {
@@ -95,7 +94,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 {
@@ -104,11 +103,11 @@ export class CoreInputs implements Inputs {
}
private static get omitName(): boolean {
return core.getInput('omitName') == 'true'
return core.getInput("omitName") == "true"
}
get commit(): string | undefined {
const commit = core.getInput('commit')
const commit = core.getInput("commit")
if (commit) {
return commit
}
@@ -116,7 +115,7 @@ export class CoreInputs implements Inputs {
}
get discussionCategory(): string | undefined {
const category = core.getInput('discussionCategory')
const category = core.getInput("discussionCategory")
if (category) {
return category
}
@@ -124,7 +123,7 @@ export class CoreInputs implements Inputs {
}
private get name(): string | undefined {
const name = core.getInput('name')
const name = core.getInput("name")
if (name) {
return name
}
@@ -133,21 +132,21 @@ export class CoreInputs implements Inputs {
}
get generateReleaseNotes(): boolean {
const generate = core.getInput('generateReleaseNotes')
return generate == 'true'
const generate = core.getInput("generateReleaseNotes")
return generate == "true"
}
get makeLatest(): "legacy" | "true" | "false" | undefined {
let latest = core.getInput('makeLatest')
let latest = core.getInput("makeLatest")
if (latest == "true" || latest == "false" || latest == "legacy") {
return latest;
return latest
}
return undefined
}
get owner(): string {
let owner = core.getInput('owner')
let owner = core.getInput("owner")
if (owner) {
return owner
}
@@ -155,17 +154,17 @@ export class CoreInputs implements Inputs {
}
get removeArtifacts(): boolean {
const removes = core.getInput('removeArtifacts')
return removes == 'true'
const removes = core.getInput("removeArtifacts")
return removes == "true"
}
get replacesArtifacts(): boolean {
const replaces = core.getInput('replacesArtifacts')
return replaces == 'true'
const replaces = core.getInput("replacesArtifacts")
return replaces == "true"
}
get repo(): string {
let repo = core.getInput('repo')
let repo = core.getInput("repo")
if (repo) {
return repo
}
@@ -177,9 +176,9 @@ export class CoreInputs implements Inputs {
}
get tag(): string {
const tag = core.getInput('tag')
const tag = core.getInput("tag")
if (tag) {
return tag;
return tag
}
const ref = this.context.ref
@@ -192,7 +191,7 @@ export class CoreInputs implements Inputs {
}
get token(): string {
return core.getInput('token', {required: true})
return core.getInput("token", { required: true })
}
get updatedDraft(): boolean | undefined {
@@ -201,7 +200,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 {
@@ -210,7 +209,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 {
@@ -219,7 +218,7 @@ export class CoreInputs implements Inputs {
}
private static get omitBodyDuringUpdate(): boolean {
return core.getInput('omitBodyDuringUpdate') == 'true'
return core.getInput("omitBodyDuringUpdate") == "true"
}
get updatedReleaseName(): string | undefined {
@@ -228,14 +227,14 @@ export class CoreInputs implements Inputs {
}
get updateOnlyUnreleased(): boolean {
return core.getInput('updateOnlyUnreleased') == 'true'
return core.getInput("updateOnlyUnreleased") == "true"
}
private static get omitNameDuringUpdate(): boolean {
return core.getInput('omitNameDuringUpdate') == 'true'
return core.getInput("omitNameDuringUpdate") == "true"
}
stringFromFile(path: string): string {
return readFileSync(path, 'utf-8')
return readFileSync(path, "utf-8")
}
}