mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-05-19 14:24:45 +00:00
Use @actions/glob for pattern matching
This commit is contained in:
parent
1e233443e8
commit
db235cfc56
12 changed files with 4427 additions and 176 deletions
|
@ -1,5 +1,6 @@
|
|||
import * as core from "@actions/core";
|
||||
import * as io from "@actions/io";
|
||||
import * as glob from "@actions/glob";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as uuidV4 from "uuid/v4";
|
||||
|
@ -81,6 +82,19 @@ export function logWarning(message: string): void {
|
|||
core.info(`${warningPrefix}${message}`);
|
||||
}
|
||||
|
||||
export async function expandPaths(patterns: string[]): Promise<string[]> {
|
||||
const paths: string[] = [];
|
||||
const workspace = process.env["GITHUB_WORKSPACE"] ?? process.cwd();
|
||||
|
||||
const globber = await glob.create(patterns.join("\n"));
|
||||
const files = await globber.glob();
|
||||
|
||||
paths.push(...files);
|
||||
|
||||
// Convert paths to relative paths here?
|
||||
return paths.map(x => path.relative(workspace, x));
|
||||
}
|
||||
|
||||
export function getSupportedEvents(): string[] {
|
||||
return [Events.Push, Events.PullRequest];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue