Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add globbing support #1524

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/ linguist-generated
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