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
32 changes: 4 additions & 28 deletions actions/preview-link-generator/__tests__/pull-updater.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,15 @@ ${PREVIEW_TABLE_END}`;

it("options are correctly constructed with expected values from import", () => {
setInput("COLLAPSIBLE_AFTER", "7");
setInput("DOCS_PATH", "test/path");
setInput("URL_BASE_PATH", "foundation");
setInput(
"opaque_leading_url_segments",
"net:view=netdesktop-7.0,framework:view=netframeworkdesktop-4.8"
);
setInput("MAX_ROW_COUNT", "42");
setInput("REPO_TOKEN", "test-token");

const opts: WorkflowInput = workflowInput;

expect(opts).toBeDefined();
expect(opts.collapsibleAfter).toBe(7);
expect(opts.docsPath).toBe("test/path");

const compareMaps = <T1, T2>(
expected: Map<T1, T2>,
actual: Map<T1, T2>
) => {
expect(expected).toBeDefined();
expect(actual).toBeDefined();

expect(expected.size).toBe(actual.size);

for (let [key, value] of expected) {
expect(actual.has(key));
expect(actual.get(key)).toBe(value);
}
};

var map: Map<string, string> = new Map();
map.set("net", "view=netdesktop-7.0");
map.set("framework", "view=netframeworkdesktop-4.8");

compareMaps(map, opts.opaqueLeadingUrlSegments);
expect(opts.maxRowCount).toBe(42);
expect(opts.repoToken).toBe("test-token");
});
it("extractPreviewLinksFromBuildReport parses file to preview URL map", () => {
const html = `
Expand Down
8 changes: 0 additions & 8 deletions actions/preview-link-generator/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ inputs:
repo_token:
description: 'The GITHUB_TOKEN secret. Requires the following permissions: pull-requests: write.'
required: true
docs_path:
description: 'The path to the docs folder, such as; "docs" for the .NET docs repo.'
default: 'docs'
url_base_path:
description: 'The URL base path for the docs repo, for example; "dotnet" for the .NET docs repo.'
default: 'dotnet'
collapsible_after:
description: 'The number at which the automated preview table defaults as collapsed but expandable, using the HTML summary and details elements.'
default: '10'
max_row_count:
description: 'The maximum number of rows to display in the automated preview table.'
default: '30'
opaque_leading_url_segments:
description: 'A (comma separated) string array of leading URL segments to exclude when creating preview links.'
runs:
using: 'node16'
main: 'dist/index.js'
21 changes: 0 additions & 21 deletions actions/preview-link-generator/dist/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 actions/preview-link-generator/dist/index.js.map

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions actions/preview-link-generator/src/types/WorkflowInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ export class WorkflowInput {
return val || 10;
}

get docsPath(): string {
const val = getInput("docs_path", { required: true });
return val || "docs";
}

get urlBasePath(): string {
const val = getInput("url_base_path", { required: true });
return val || "dotnet";
}

get repoToken(): string {
const val = getInput("repo_token", { required: true });
return val;
Expand All @@ -28,20 +18,6 @@ export class WorkflowInput {
return parseInt(val || "30");
}

get opaqueLeadingUrlSegments(): Map<string, string> {
const val = getInput("opaque_leading_url_segments");
if (val) {
const map = new Map<string, string>();
const pairs = val.split(",");
pairs.forEach((pair) => {
const [key, value] = pair.split(":");
map.set(key.trim(), value.trim());
});
return map;
}
return new Map();
}

constructor() {}
}

Expand Down
Loading