Skip to content

Commit

Permalink
feat: add globbing support
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaduck committed Oct 23, 2024
1 parent f212e6c commit 27cb47b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 7 deletions.
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
15 changes: 8 additions & 7 deletions src/buildExec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 27cb47b

Please sign in to comment.