diff --git a/action.yml b/action.yml index a9ec758..3d38ce1 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,7 @@ inputs: file: description: 'Path to coverage file to upload' required: false + deprecationMessage: 'Use the `files` input instead, it supports globs' files: description: 'Comma-separated list of files to upload' required: false diff --git a/package-lock.json b/package-lock.json index 5061e27..943dc46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", + "tinyglobby": "^0.2.9", "undici": "5.28.4" }, "devDependencies": { @@ -5184,6 +5185,45 @@ "dev": true, "license": "MIT" }, + "node_modules/tinyglobby": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.9.tgz", + "integrity": "sha512-8or1+BGEdk1Zkkw2ii16qSS7uVrQJPre5A9o/XkWPATkk23FZh/15BKFxPnlTy6vkljZxLqYCzzBMj30ZrSvjw==", + "license": "MIT", + "dependencies": { + "fdir": "^6.4.0", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", diff --git a/package.json b/package.json index 45798c4..b584af8 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", + "tinyglobby": "^0.2.9", "undici": "5.28.4" }, "devDependencies": { diff --git a/src/buildExec.ts b/src/buildExec.ts index 9e80dd1..7abcfa3 100644 --- a/src/buildExec.ts +++ b/src/buildExec.ts @@ -3,6 +3,7 @@ import * as core from '@actions/core'; import * as github from '@actions/github'; import {type PullRequestEvent} from '@octokit/webhooks-types'; +import {glob} from 'tinyglobby'; import {setFailure} from './helpers'; @@ -309,15 +310,15 @@ const buildUploadExec = async (): Promise<{ uploadExecArgs.push('-f', file); } if (files) { - files + const globs = files .split(',') .map((f) => f.trim()) - .forEach((f) => { - if (f.length > 0) { - // this handles trailing commas - uploadExecArgs.push('-f', f); - } - }); + // This handles trailing commas. + .filter((f) => f.length > 0); + const globbed = await glob(globs); + globbed.map((f) => { + uploadExecArgs.push('-f', f); + }); } if (flags) { flags