github: move artifact and summary logic to dedicated classes

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-02-05 13:10:16 +01:00
parent 4748d57f98
commit e169fb346d
28 changed files with 616 additions and 516 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {GitHubContentOpts} from '../github.js';
import {GitHubContentOpts} from '../github/github.js';
export interface Cert {
cacert?: string;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {GitHubContentOpts} from '../github.js';
import {GitHubContentOpts} from '../github/github.js';
export interface DownloadVersion {
key: string;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {GitHubContentOpts} from '../github.js';
import {GitHubContentOpts} from '../github/github.js';
export interface DownloadVersion {
version: string;

View File

@@ -0,0 +1,28 @@
/**
* Copyright 2026 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface UploadOpts {
filename: string;
mimeType?: string;
retentionDays?: number;
}
export interface UploadResponse {
id: number;
filename: string;
size: number;
url: string;
}

View File

@@ -14,17 +14,10 @@
* limitations under the License.
*/
import * as core from '@actions/core';
import {AnnotationProperties} from '@actions/core';
import type {getOctokit} from '@actions/github';
import {JwtPayload} from 'jwt-decode';
import {BakeDefinition} from './buildx/bake.js';
import {ExportResponse} from './buildx/history.js';
export type SummaryTableRow = Parameters<typeof core.summary.addTable>[0][number];
export type SummaryTableCell = Exclude<SummaryTableRow[number], string>;
export interface GitHubRelease {
id: number;
tag_name: string;
@@ -54,27 +47,3 @@ export interface GitHubActionsRuntimeTokenAC {
export interface GitHubAnnotation extends AnnotationProperties {
message: string;
}
export interface UploadArtifactOpts {
filename: string;
mimeType?: string;
retentionDays?: number;
}
export interface UploadArtifactResponse {
id: number;
filename: string;
size: number;
url: string;
}
export interface BuildSummaryOpts {
exportRes: ExportResponse;
uploadRes?: UploadArtifactResponse;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputs?: any;
bakeDefinition?: BakeDefinition;
// builder options
driver?: string;
endpoint?: string;
}

View File

@@ -0,0 +1,35 @@
/**
* Copyright 2026 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as core from '@actions/core';
import {UploadResponse} from './artifact';
import {BakeDefinition} from '../buildx/bake';
import {ExportResponse} from '../buildx/history';
export type SummaryTableRow = Parameters<typeof core.summary.addTable>[0][number];
export type SummaryTableCell = Exclude<SummaryTableRow[number], string>;
export interface BuildSummaryOpts {
exportRes: ExportResponse;
uploadRes?: UploadResponse;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputs?: any;
bakeDefinition?: BakeDefinition;
// builder options
driver?: string;
endpoint?: string;
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {GitHubContentOpts} from '../github.js';
import {GitHubContentOpts} from '../github/github.js';
export interface DownloadVersion {
version: string;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {GitHubContentOpts} from '../github.js';
import {GitHubContentOpts} from '../github/github.js';
export interface DownloadVersion {
version: string;