ramda#splitEvery TypeScript Examples
The following examples show how to use
ramda#splitEvery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: main.ts From checkstyle-github-action with MIT License | 5 votes |
async function run(): Promise<void> {
try {
const path = core.getInput(Inputs.Path, {required: true})
const name = core.getInput(Inputs.Name)
const title = core.getInput(Inputs.Title)
const searchResult = await findResults(path)
if (searchResult.filesToUpload.length === 0) {
core.warning(
`No files were found for the provided path: ${path}. No results will be uploaded.`
)
} else {
core.info(
`With the provided path, there will be ${searchResult.filesToUpload.length} results uploaded`
)
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
const annotations: Annotation[] = chain(
annotationsForPath,
searchResult.filesToUpload
)
core.debug(
`Grouping ${annotations.length} annotations into chunks of ${MAX_ANNOTATIONS_PER_REQUEST}`
)
const groupedAnnotations: Annotation[][] =
annotations.length > MAX_ANNOTATIONS_PER_REQUEST
? splitEvery(MAX_ANNOTATIONS_PER_REQUEST, annotations)
: [annotations]
core.debug(`Created ${groupedAnnotations.length} buckets`)
const conclusion = getConclusion(annotations)
for (const annotationSet of groupedAnnotations) {
await createCheck(
name,
title,
annotationSet,
annotations.length,
conclusion
)
}
}
} catch (error) {
core.setFailed(error instanceof Error ? error : String(error))
}
}
Example #2
Source File: main.ts From spotbugs-github-action with MIT License | 5 votes |
async function run(): Promise<void> {
try {
const path = core.getInput(Inputs.Path, {required: true})
const name = core.getInput(Inputs.Name)
const title = core.getInput(Inputs.Title)
const searchResult = await findResults(path)
if (searchResult.filesToUpload.length === 0) {
core.warning(
`No files were found for the provided path: ${path}. No results will be uploaded.`
)
} else {
core.info(
`With the provided path, there will be ${searchResult.filesToUpload.length} results uploaded`
)
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
const annotations: Annotation[] = chain(
annotationsForPath,
searchResult.filesToUpload
)
core.debug(
`Grouping ${annotations.length} annotations into chunks of ${MAX_ANNOTATIONS_PER_REQUEST}`
)
const groupedAnnotations: Annotation[][] =
annotations.length > MAX_ANNOTATIONS_PER_REQUEST
? splitEvery(MAX_ANNOTATIONS_PER_REQUEST, annotations)
: [annotations]
core.debug(`Created ${groupedAnnotations.length} buckets`)
for (const annotationSet of groupedAnnotations) {
await createCheck(name, title, annotationSet, annotations.length)
}
}
} catch (error) {
core.setFailed(error instanceof Error ? error : String(error))
}
}