mirror of
https://github.com/actions/upload-artifact.git
synced 2025-04-05 22:19:38 +00:00
add compression level input
This commit is contained in:
@ -3,7 +3,8 @@ export enum Inputs {
|
||||
Name = 'name',
|
||||
Path = 'path',
|
||||
IfNoFilesFound = 'if-no-files-found',
|
||||
RetentionDays = 'retention-days'
|
||||
RetentionDays = 'retention-days',
|
||||
CompressionLevel = 'compression-level'
|
||||
}
|
||||
|
||||
export enum NoFileOptions {
|
||||
|
@ -36,5 +36,17 @@ export function getInputs(): UploadInputs {
|
||||
}
|
||||
}
|
||||
|
||||
const compressionLevelStr = core.getInput(Inputs.CompressionLevel)
|
||||
if (compressionLevelStr) {
|
||||
inputs.compressionLevel = parseInt(compressionLevelStr)
|
||||
if (isNaN(inputs.compressionLevel)) {
|
||||
core.setFailed('Invalid compression-level')
|
||||
}
|
||||
|
||||
if (inputs.compressionLevel < 0 || inputs.compressionLevel > 9) {
|
||||
core.setFailed('Invalid compression-level. Valid values are 0-9')
|
||||
}
|
||||
}
|
||||
|
||||
return inputs
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
import * as core from '../node_modules/@actions/core/'
|
||||
import {UploadOptions, create} from '../node_modules/@actions/artifact/lib/artifact'
|
||||
import {
|
||||
UploadOptions,
|
||||
create
|
||||
} from '../node_modules/@actions/artifact/lib/artifact'
|
||||
import {findFilesToUpload} from './search'
|
||||
import {getInputs} from './input-helper'
|
||||
import {NoFileOptions} from './constants'
|
||||
@ -43,6 +46,10 @@ async function run(): Promise<void> {
|
||||
options.retentionDays = inputs.retentionDays
|
||||
}
|
||||
|
||||
if (typeof inputs.compressionLevel !== 'undefined') {
|
||||
options.compressionLevel = inputs.compressionLevel
|
||||
}
|
||||
|
||||
const uploadResponse = await artifactClient.uploadArtifact(
|
||||
inputs.artifactName,
|
||||
searchResult.filesToUpload,
|
||||
|
@ -20,4 +20,9 @@ export interface UploadInputs {
|
||||
* Duration after which artifact will expire in days
|
||||
*/
|
||||
retentionDays: number
|
||||
|
||||
/**
|
||||
* The level of compression for Zlib to be applied to the artifact archive.
|
||||
*/
|
||||
compressionLevel?: number
|
||||
}
|
||||
|
Reference in New Issue
Block a user