2020-01-06 11:37:12 +01:00
|
|
|
import * as path from 'path'
|
2020-01-05 12:04:24 +01:00
|
|
|
import * as core from '@actions/core'
|
|
|
|
|
2020-01-06 11:37:12 +01:00
|
|
|
import * as validate from './validate'
|
2020-01-05 12:04:24 +01:00
|
|
|
|
2020-01-05 12:55:59 +01:00
|
|
|
export async function run(): Promise<void> {
|
2020-01-06 11:37:12 +01:00
|
|
|
try {
|
2020-01-10 17:54:22 +01:00
|
|
|
const minWrapperCount = +core.getInput('min-wrapper-count')
|
2020-01-06 11:37:12 +01:00
|
|
|
const allowSnapshots = core.getInput('allow-snapshots') === 'true'
|
2020-01-06 13:36:28 +01:00
|
|
|
const allowChecksums = core.getInput('allow-checksums').split(',')
|
2020-01-06 11:37:12 +01:00
|
|
|
const invalidWrapperJars = await validate.findInvalidWrapperJars(
|
|
|
|
path.resolve('.'),
|
2020-01-10 17:54:22 +01:00
|
|
|
minWrapperCount,
|
2020-01-06 13:36:28 +01:00
|
|
|
allowSnapshots,
|
|
|
|
allowChecksums
|
2020-01-06 11:37:12 +01:00
|
|
|
)
|
|
|
|
if (invalidWrapperJars.length > 0) {
|
2020-01-06 13:50:19 +01:00
|
|
|
const list = invalidWrapperJars.map(
|
|
|
|
invalid => `${invalid.checksum} ${invalid.path}`
|
|
|
|
)
|
|
|
|
core.setFailed(
|
|
|
|
`Found unknown Gradle Wrapper JAR files\n${list.join('\n- ')}`
|
|
|
|
)
|
2020-01-05 12:55:59 +01:00
|
|
|
}
|
2020-01-06 11:37:12 +01:00
|
|
|
} catch (error) {
|
|
|
|
core.setFailed(error.message)
|
|
|
|
}
|
2020-01-05 12:04:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
run()
|