Skip to content

Commit 063ed2b

Browse files
committed
Refactor the filePath/filePattern handling
1 parent 0d7e77b commit 063ed2b

File tree

5 files changed

+7
-138
lines changed

5 files changed

+7
-138
lines changed

condaParser.ts

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,58 +15,10 @@ import {
1515
} from '@github/dependency-submission-toolkit'
1616
import { YAMLMap } from 'yaml';
1717

18-
/**getManifestFromEnvironmentFile(document, fileName) {
19-
core.debug(`getManifestFromEnvironmentFile processing ${fileName}`);
20-
21-
let manifest = new Manifest("Environment", fileName);
22-
23-
24-
/**
25-
let manifest = new Manifest(document.name, fileName);
26-
27-
core.debug(`Processing ${document.packages?.length} packages`);
28-
29-
document.packages?.forEach(pkg => {
30-
let packageName = pkg.name;
31-
let packageVersion = pkg.packageVersion;
32-
let referenceLocator = pkg.externalRefs?.find(ref => ref.referenceCategory === "PACKAGE-MANAGER" && ref.referenceType === "purl")?.referenceLocator;
33-
let genericPurl = `pkg:generic/${packageName}@${packageVersion}`;
34-
// SPDX 2.3 defines a purl field
35-
let purl;
36-
if (pkg.purl != undefined) {
37-
purl = pkg.purl;
38-
} else if (referenceLocator != undefined) {
39-
purl = referenceLocator;
40-
} else {
41-
purl = genericPurl;
42-
}
43-
44-
// Working around weird encoding issues from an SBOM generator
45-
// Find the last instance of %40 and replace it with @
46-
purl = replaceVersionEscape(purl);
47-
48-
let relationships = document.relationships?.find(rel => rel.relatedSpdxElement == pkg.SPDXID && rel.relationshipType == "DEPENDS_ON" && rel.spdxElementId != "SPDXRef-RootPackage");
49-
if (relationships != null && relationships.length > 0) {
50-
manifest.addIndirectDependency(new Package(purl));
51-
} else {
52-
manifest.addDirectDependency(new Package(purl));
53-
}
54-
});
55-
return manifest;
56-
}*/
57-
58-
/***/
59-
6018
export default class CondaParser {
6119

6220
static searchFiles(filePath = "", filePattern = "") {
63-
if (filePath == "") {
64-
let filePath = core.getInput('filePath');
65-
}
66-
if (filePattern == "") {
67-
let filePattern = core.getInput('filePattern');
68-
}
69-
21+
core.debug(`Searching for files in ${filePath} with pattern ${filePattern}`);
7022
return glob.sync(`${filePath}/${filePattern}`, {});
7123
}
7224

dist/condaParser.d.ts

Lines changed: 0 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 3 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
import CondaParser from './condaParser';
1414

1515
async function run() {
16-
let manifests = CondaParser.getManifestsFromEnvironmentFiles(CondaParser.searchFiles());
16+
let manifests = CondaParser.getManifestsFromEnvironmentFiles(
17+
CondaParser.searchFiles(core.getInput('filePath'), core.getInput('filePattern')));
1718

1819
let snapshot = new Snapshot({
1920
name: "conda-dependency-submission-action",

0 commit comments

Comments
 (0)