Skip to content

Commit

Permalink
chore: release package
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklafrance committed Apr 9, 2024
1 parent a400fac commit 24798e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-crews-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workleap/chromatic-ado": patch
---

Minor changes.
15 changes: 11 additions & 4 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ async function run() {
// Accepting the baseline automatically when Chromatic is executed on the "main" branch.
// Running Chromatic on the "main" branch allow us to use "squash" merge for PRs, see: https://www.chromatic.com/docs/custom-ci-provider/#squashrebase-merge-and-the-main-branch.
// Furthermore, changes from PR doesn't seem to be updating the baseline at all but I don't know why, it seems like a bug with ADO.
const isAutoAcceptChanges = getVariable("Build.Reason") !== "PullRequest" && getVariable("Build.SourceBranch") === "refs/heads/main";
const isAutoAcceptingChanges = getVariable("Build.Reason") !== "PullRequest" && getVariable("Build.SourceBranch") === "refs/heads/main";

if (isAutoAcceptChanges) {
if (isAutoAcceptingChanges) {
argv.push("--auto-accept-changes", "main");
}

Expand All @@ -58,8 +58,15 @@ async function run() {
return;
}

if (isAutoAcceptChanges) {
setResult(TaskResult.Succeeded, `${output.changeCount} changes has been automatically accepted.`);
// Chromatic will returns changes event if they are automatically accepted.
if (isAutoAcceptingChanges) {
const message = output.changeCount > 0
? `${output.changeCount} visual ${output.changeCount === 1 ? "change" : "changes"} has been automatically accepted.`
: "";

setResult(TaskResult.Succeeded, message);

return;
}

const comment = `
Expand Down

0 comments on commit 24798e0

Please sign in to comment.