Skip to content

Commit

Permalink
Merge branch 'master' into workflow-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2b3bfa0 committed Sep 22, 2022
2 parents 96cbc0e + 82af532 commit 2c7194b
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 43 deletions.
5 changes: 5 additions & 0 deletions bin/cml/comment/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ exports.options = kebabcaseKeys({
type: 'boolean',
description: 'Upload any local images found in the Markdown report'
},
publishUrl: {
type: 'string',
default: 'https://asset.cml.dev',
description: 'Self-hosted image server URL'
},
watch: {
type: 'boolean',
description: 'Watch for changes and automatically update the comment'
Expand Down
9 changes: 9 additions & 0 deletions bin/cml/comment/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ describe('Comment integration tests', () => {
[string] [default: \\"HEAD\\"]
--publish Upload any local images found in the Markdown report
[boolean]
--publish-url Self-hosted image server URL
[string] [default: \\"https://asset.cml.dev\\"]
--watch Watch for changes and automatically update the
comment [boolean]
--native Uses driver's native capabilities to upload assets
Expand Down Expand Up @@ -64,4 +66,11 @@ describe('Comment integration tests', () => {
await fs.writeFile(path, report);
await exec(`node ./bin/cml.js send-comment ${path}`);
});

test('cml send-comment --publish to current repo', async () => {
const report = `## Test Comment\n![](assets/logo.png)`;

await fs.writeFile(path, report);
await exec(`node ./bin/cml.js send-comment --publish ${path}`);
});
});
81 changes: 40 additions & 41 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"form-data": "^3.0.1",
"fs-extra": "^9.1.0",
"getos": "^3.2.1",
"git-url-parse": "^12.0.0",
"git-url-parse": "^13.1.0",
"globby": "^11.0.4",
"https-proxy-agent": "^5.0.1",
"js-base64": "^3.7.2",
Expand Down
7 changes: 6 additions & 1 deletion src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class CML {
update,
pr,
publish,
publishUrl,
markdownFile,
report: testReport,
watch,
Expand Down Expand Up @@ -208,7 +209,11 @@ class CML {
);
if (!triggerFile && watch) watcher.add(absolutePath);
try {
node.url = await this.publish({ ...opts, path: absolutePath });
node.url = await this.publish({
...opts,
path: absolutePath,
url: publishUrl
});
} catch (err) {
if (err.code !== 'ENOENT') throw err;
}
Expand Down

2 comments on commit 2c7194b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

Please sign in to comment.