Skip to content

Commit 48645c3

Browse files
authored
add configuration for custom pkg names (#5)
1 parent 0c778db commit 48645c3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
uses: guyarb/[email protected]
3939
with:
4040
test-results: test.json
41+
package-name: foobar # optional, if using custom package name, github.com/owner/repo stripped from the pathname by default
4142
```
4243
4344
## Development of this action

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const lineReader = require('line-by-line');
33

44
try {
55
const testResultsPath = core.getInput('test-results');
6+
const customPackageName = core.getInput('package-name');
67

78
var obj = new Object();
89
var lr = new lineReader(testResultsPath);
@@ -18,8 +19,12 @@ try {
1819
return;
1920
}
2021
output = output.replace("\n", "%0A").replace("\r", "%0D")
21-
// Removing the github.com/owner/reponame
22+
// Strip github.com/owner/repo package from the path by default
2223
var packageName = currentLine.Package.split("/").slice(3).join("/");
24+
// If custom package is provided, strip custom package name from the path
25+
if (customPackageName != null) {
26+
packageName = currentLine.Package.replace(customPackageName + "/", "")
27+
}
2328
var newEntry = packageName + "/" + testName;
2429
if (!obj.hasOwnProperty(newEntry)) {
2530
obj[newEntry] = output;

0 commit comments

Comments
 (0)