Skip to content

Commit

Permalink
fix: Make sure all invalid chars are replaced for artifact names -- f…
Browse files Browse the repository at this point in the history
…ixes #396 (#417)

Signed-off-by: lts-po <philip@supernetworks.org>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Co-authored-by: lts-po <philip@supernetworks.org>
Co-authored-by: Keith Zantow <kzantow@gmail.com>
  • Loading branch information
3 people committed May 3, 2023
1 parent ea7104d commit a59054d
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 229 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm audit --production
- run: npm run package
- run: git status --porcelain
- run: git diff
Expand Down
2 changes: 1 addition & 1 deletion dist/attachReleaseAssets/index.js

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

2 changes: 1 addition & 1 deletion dist/downloadSyft/index.js

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

2 changes: 1 addition & 1 deletion dist/runSyftAction/index.js

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

438 changes: 226 additions & 212 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
"@actions/http-client": "^2.1.0",
"@actions/tool-cache": "^2.0.1",
"@octokit/core": "^4.2.0",
"@octokit/webhooks": "^10.7.0",
"@octokit/webhooks": "^11.0.0",
"fast-safe-stringify": "^2.1.1",
"npm-check-updates": "^16.9.0"
"npm-check-updates": "^16.10.9"
},
"devDependencies": {
"@octokit/webhooks-types": "^6.10.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@octokit/webhooks-types": "^6.11.0",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.3",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@vercel/ncc": "^0.36.1",
"eol-converter-cli": "^1.0.8",
"eslint": "^8.37.0",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-node": "^11.1.0",
Expand All @@ -62,11 +62,11 @@
"jest": "^29.5.0",
"js-yaml": "^4.1.0",
"npm-run-all": "^4.1.5",
"prettier": "2.8.7",
"prettier": "2.8.8",
"prettier-plugin-organize-imports": "^3.2.2",
"pretty-quick": "^3.1.3",
"ts-jest": "^29.0.5",
"type-fest": "^3.7.2",
"typescript": "^5.0.3"
"ts-jest": "^29.1.0",
"type-fest": "^3.9.0",
"typescript": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion src/github/SyftGithubAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getArtifactName(): string {
if (parts.length > 2) {
parts.splice(0, 1);
}
const prefix = parts.join("-").replace(/[^-a-zA-Z0-9]/, "_");
const prefix = parts.join("-").replace(/[^-a-zA-Z0-9]/g, "_");
return `${prefix}.${extension}`;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/SyftGithubAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,17 @@ describe("Action", () => {
});

expect(action.getArtifactName()).toBe("img.cyclonedx.json");

});

it("correctly encode tags", () => {
setData({
inputs: {
image: "ghcr.io/something-something/image-image:0.1.2-dev"
}
});

expect(action.getArtifactName()).toBe("something-something-image-image_0_1_2-dev.spdx.json");
});

it ("properly maps paths for WSL", () => {
Expand Down

0 comments on commit a59054d

Please sign in to comment.