mirror of
https://github.com/actions/toolkit
synced 2025-05-09 16:43:02 +00:00
[Artifacts] Name validation + zip specification creation (#1482)
* Artifact name validation + zip specification creation * Fix linting issues * Grammar fix * Update test description
This commit is contained in:
parent
2461056696
commit
7da3ac6eda
6 changed files with 620 additions and 8 deletions
|
@ -1,17 +1,39 @@
|
|||
import * as core from '@actions/core'
|
||||
import {UploadOptions} from './upload-options'
|
||||
import {UploadResponse} from './upload-response'
|
||||
import {validateArtifactName} from './path-and-artifact-name-validation'
|
||||
import {
|
||||
UploadZipSpecification,
|
||||
getUploadZipSpecification,
|
||||
validateRootDirectory
|
||||
} from './upload-zip-specification'
|
||||
|
||||
export async function uploadArtifact(
|
||||
name: string,
|
||||
files: string[], // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
rootDirectory: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
files: string[],
|
||||
rootDirectory: string,
|
||||
options?: UploadOptions | undefined // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
): Promise<UploadResponse> {
|
||||
validateArtifactName(name)
|
||||
validateRootDirectory(rootDirectory)
|
||||
|
||||
const zipSpecification: UploadZipSpecification[] = getUploadZipSpecification(
|
||||
files,
|
||||
rootDirectory
|
||||
)
|
||||
if (zipSpecification.length === 0) {
|
||||
core.warning(`No files were found to upload`)
|
||||
return {
|
||||
success: false
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - Implement upload functionality
|
||||
|
||||
const uploadResponse: UploadResponse = {
|
||||
artifactName: name,
|
||||
size: 0
|
||||
success: true,
|
||||
size: 0,
|
||||
id: 0
|
||||
}
|
||||
|
||||
return uploadResponse
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue