Skip to content
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
29 changes: 28 additions & 1 deletion common/src/path-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { filterPaths } from "./path-utils";
import { filterPaths, splitPaths } from "./path-utils";

describe('path utils', () => {

Expand Down Expand Up @@ -89,4 +89,31 @@ describe('path utils', () => {
expect(filterPaths(paths, patterns)).toEqual(expected);
});
});

describe('splitPaths', () => {
test.each([
{
paths: '',
expected: []
},
{
paths: 'a.cdx.json',
expected: ['a.cdx.json']
},
{
paths: 'a.cdx.json,b.cdx.json',
expected: ['a.cdx.json', 'b.cdx.json']
},
{
paths: 'a.cdx.json;b.cdx.json',
expected: ['a.cdx.json', 'b.cdx.json']
},
{
paths: 'a.cdx.json\r\nb.cdx.json\n c.cdx.json ',
expected: ['a.cdx.json', 'b.cdx.json', 'c.cdx.json']
},
])('basic cases [%#]', ({ paths, expected }) => {
expect(splitPaths(paths)).toEqual(expected);
});
});
});
7 changes: 7 additions & 0 deletions common/src/path-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ function filterPathsImpl(
}, false);
});
}

export function splitPaths(paths: string): string[] {
return paths
.split(/[\r\n,;]+/)
.map(path => path.trim())
.filter(path => path.length > 0);
}
7 changes: 7 additions & 0 deletions get-changed-files/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ var __importStar = (this && this.__importStar) || (function () {
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.filterPaths = filterPaths;
exports.splitPaths = splitPaths;
const core = __importStar(__nccwpck_require__(1751));
const minimatch_1 = __nccwpck_require__(4804);
const NEGATION = '!';
Expand All @@ -148,6 +149,12 @@ function filterPathsImpl(paths, patterns) {
}, false);
});
}
function splitPaths(paths) {
return paths
.split(/[\r\n,;]+/)
.map(path => path.trim())
.filter(path => path.length > 0);
}


/***/ }),
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ packages:
- get-changed-files
- pr-filter
- send-teams-notification
- validate-sbom
- verify-version-change

catalog:
Expand Down
7 changes: 7 additions & 0 deletions pr-filter/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ var __importStar = (this && this.__importStar) || (function () {
})();
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.filterPaths = filterPaths;
exports.splitPaths = splitPaths;
const core = __importStar(__nccwpck_require__(1751));
const minimatch_1 = __nccwpck_require__(4804);
const NEGATION = '!';
Expand All @@ -148,6 +149,12 @@ function filterPathsImpl(paths, patterns) {
}, false);
});
}
function splitPaths(paths) {
return paths
.split(/[\r\n,;]+/)
.map(path => path.trim())
.filter(path => path.length > 0);
}


/***/ }),
Expand Down
18 changes: 18 additions & 0 deletions validate-sbom/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: validate-sbom
description: Install CycloneDX CLI and validate SBOM file(s)

inputs:
input-format:
description: SBOM file format
required: false
default: json
input-file:
description: Path to SBOM file to validate
required: false
input-files:
description: Newline, comma, or semicolon separated paths to SBOM files to validate
required: false

runs:
using: node24
main: dist/index.js
Loading