feat: add globbing support

This commit is contained in:
Eli 2024-10-22 21:06:57 -05:00
parent f212e6ccd4
commit 27cb47b7e6
No known key found for this signature in database
GPG key ID: 3A3A022687B8091C
4 changed files with 50 additions and 7 deletions

View file

@ -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

40
package-lock.json generated
View file

@ -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",

View file

@ -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": {

View file

@ -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