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 configuration for custom pkg names #5

Merged
merged 1 commit into from
Feb 8, 2021
Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
uses: guyarb/[email protected]
with:
test-results: test.json
package-name: foobar # optional, if using custom package name, github.com/owner/repo stripped from the pathname by default
```

## Development of this action
Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const lineReader = require('line-by-line');

try {
const testResultsPath = core.getInput('test-results');
const customPackageName = core.getInput('package-name');

var obj = new Object();
var lr = new lineReader(testResultsPath);
Expand All @@ -18,8 +19,12 @@ try {
return;
}
output = output.replace("\n", "%0A").replace("\r", "%0D")
// Removing the github.com/owner/reponame
// Strip github.com/owner/repo package from the path by default
var packageName = currentLine.Package.split("/").slice(3).join("/");
// If custom package is provided, strip custom package name from the path
if (customPackageName != null) {
packageName = currentLine.Package.replace(customPackageName + "/", "")
}
var newEntry = packageName + "/" + testName;
if (!obj.hasOwnProperty(newEntry)) {
obj[newEntry] = output;
Expand Down