UNPKG

@actions/artifact

Version:
27 lines 977 B
import { Timestamp } from '../../generated/index.js'; import * as core from '@actions/core'; export function getExpiration(retentionDays) { if (!retentionDays) { return undefined; } const maxRetentionDays = getRetentionDays(); if (maxRetentionDays && maxRetentionDays < retentionDays) { core.warning(`Retention days cannot be greater than the maximum allowed retention set within the repository. Using ${maxRetentionDays} instead.`); retentionDays = maxRetentionDays; } const expirationDate = new Date(); expirationDate.setDate(expirationDate.getDate() + retentionDays); return Timestamp.fromDate(expirationDate); } function getRetentionDays() { const retentionDays = process.env['GITHUB_RETENTION_DAYS']; if (!retentionDays) { return undefined; } const days = parseInt(retentionDays); if (isNaN(days)) { return undefined; } return days; } //# sourceMappingURL=retention.js.map