mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-16 19:08:04 +08:00
move getExpiration to upload-artifact
This commit is contained in:
@@ -8,8 +8,8 @@ import {
|
||||
getUploadZipSpecification,
|
||||
validateRootDirectory
|
||||
} from './upload-zip-specification'
|
||||
import {getBackendIdsFromToken, getExpiration} from '../shared/util'
|
||||
import {CreateArtifactRequest} from 'src/generated'
|
||||
import {getBackendIdsFromToken} from '../shared/util'
|
||||
import {CreateArtifactRequest, Timestamp} from 'src/generated'
|
||||
|
||||
export async function uploadArtifact(
|
||||
name: string,
|
||||
@@ -91,3 +91,14 @@ export async function uploadArtifact(
|
||||
|
||||
return uploadResponse
|
||||
}
|
||||
|
||||
function getExpiration(retentionDays?: number): Timestamp | undefined {
|
||||
if (!retentionDays) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const expirationDate = new Date()
|
||||
expirationDate.setDate(expirationDate.getDate() + retentionDays)
|
||||
|
||||
return Timestamp.fromDate(expirationDate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user