Skip to content
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
10 changes: 8 additions & 2 deletions dist/attachReleaseAssets/index.js

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

10 changes: 8 additions & 2 deletions dist/downloadSyft/index.js

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

10 changes: 8 additions & 2 deletions dist/runSyftAction/index.js

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

6 changes: 4 additions & 2 deletions src/github/SyftGithubAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
getClient,
} from "./GithubClient";
import { downloadSyftFromZip } from "./SyftDownloader";
import { stringify } from "./Util";
import { stringify, stripEmojis } from "./Util";

export const SYFT_BINARY_NAME = "syft";
export const SYFT_VERSION = core.getInput("syft-version") || VERSION;
Expand Down Expand Up @@ -462,7 +462,9 @@ export async function uploadDependencySnapshot(): Promise<void> {

// Need to add the job and repo details
snapshot.job = {
correlator: core.getInput("dependency-snapshot-correlator") || correlator,
correlator: stripEmojis(
core.getInput("dependency-snapshot-correlator") || correlator
),
id: `${runId}`,
};
snapshot.sha = sha;
Expand Down
7 changes: 7 additions & 0 deletions src/github/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ import s from "fast-safe-stringify";
export function stringify(o: any): string {
return s(o, undefined, 2);
}

export function stripEmojis(text: string): string {
// Regular expression to match emojis
const emojiRegex =
/(?:[\u2700-\u27BF]|[\uE000-\uF8FF]|[\uD83C-\uDBFF][\uDC00-\uDFFF]|\ud83d[\udc00-\ude4f\ude80-\udeff]|\ud83e[\udd10-\udd3f\udd40-\uddff])/g;
return text.replace(emojiRegex, "");
}
21 changes: 21 additions & 0 deletions tests/Util.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { stripEmojis } from "../src/github/Util";

describe("stripEmojis", () => {
it("Should not modify strings without emojis", () => {
const input = "Workflow for building my awesome app";
const output = stripEmojis(input);
expect(output).toBe(input);
});

it("should remove single emojis from strings", () => {
const input = "Workflow for building my awesome app🏗";
const output = stripEmojis(input);
expect(output).toBe("Workflow for building my awesome app");
});

it("should remove multiple emojis from strings", () => {
const input = "🚀Good 🧹morning 🏗!";
const output = stripEmojis(input);
expect(output).toBe("Good morning !");
});
});
Loading