From f1d0fda55e2bac0228c7d5e69d30add25532892b Mon Sep 17 00:00:00 2001 From: winkerVSbecks Date: Fri, 18 Oct 2024 14:34:20 -0400 Subject: [PATCH] add FAQ for overring branch name --- .../faq/override-branch-name.mdx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/content/troubleshooting/faq/override-branch-name.mdx diff --git a/src/content/troubleshooting/faq/override-branch-name.mdx b/src/content/troubleshooting/faq/override-branch-name.mdx new file mode 100644 index 00000000..f48b4994 --- /dev/null +++ b/src/content/troubleshooting/faq/override-branch-name.mdx @@ -0,0 +1,25 @@ +--- +layout: "../../../layouts/FAQLayout.astro" +sidebar: { hide: true } +title: Override the branch name for certain CI providers +section: ci +--- + +# Override the branch name if Chromatic is unable to identify the correct one on CI? + +In some cases, Chromatic's automatic CI detection is unable to figure out the branch name associated with a build. You'll see a message like this in your build logs: + +```bash +Removing unknown owner prefix from branch name. You may wish to set the branch directly to avoid incorrect values. +``` + +In this case, you can set the branch name directly setting `CHROMATIC_SHA`, `CHROMATIC_BRANCH` and `CHROMATIC_SLUG` environment variables. For example, in a GitHub Actions workflow: + +```yaml +- name: Chromatic + env: + CHROMATIC_SHA: ${{ github.sha }} + CHROMATIC_BRANCH: ${{ github.ref }} + CHROMATIC_SLUG: ${{ github.repository }} + run: npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN +```