如何自动接受主要分支的彩色 github 工作流程的更改?

How to auto accept changes in chromatic github workflow for main branch?

在 Chromatic github 工作流程中,如果分支是 main,我如何使用 CLI 选项 --auto-accept-changes 自动接受所有更改?

我正在使用以下 github chromatic workflow 以彩色方式部署我的应用程序的组件:

# .github/workflows/chromatic.yml

# Workflow name
name: 'Chromatic'

# Event for the workflow
on: push

# List of jobs
jobs:
  chromatic-deployment:
    # Operating System
    runs-on: ubuntu-latest
    # Job steps
    steps:
      - uses: actions/checkout@v1
      - name: Install dependencies
        run: yarn
        #  Adds Chromatic as a step in the workflow
      - name: Publish to Chromatic
        uses: chromaui/action@v1
        # Chromatic GitHub Action options
        with:
          token: ${{ secrets.REPO_GITHUB_TOKEN }}
          #  Chromatic projectToken, refer to the manage page to obtain it.
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

分支检测出现 in the docs,但我不确定如何在我的 yml 文件中使用它,因为我的操作只是 yarn.

您有 autoAcceptChanges 可以定义标志或分支名称的地方

- uses: chromaui/action@v1
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    projectToken: 'Your chromatic project token'
    buildScriptName: 'The npm script that builds your Storybook [build-storybook]'
    storybookBuildDir: 'Provide a directory with your built storybook; use if you've already built your storybook'
    allowConsoleErrors: 'Do not exit when runtime errors occur in storybook'
    autoAcceptChanges: 'Automatically accept all changes in chromatic: boolean or branchname'
    exitZeroOnChanges: 'Positive exit of action even when there are changes: boolean or branchname'
    exitOnceUploaded: 'Exit with 0 once the built version has been sent to chromatic: boolean or branchname'

所以应该是:

# .github/workflows/chromatic.yml

# Workflow name
name: 'Chromatic'

# Event for the workflow
on: push

# List of jobs
jobs:
  chromatic-deployment:
    # Operating System
    runs-on: ubuntu-latest
    # Job steps
    steps:
      - uses: actions/checkout@v1
      - name: Install dependencies
        run: yarn
        #  Adds Chromatic as a step in the workflow
      - name: Publish to Chromatic
        uses: chromaui/action@v1
        # Chromatic GitHub Action options
        with:
          token: ${{ secrets.REPO_GITHUB_TOKEN }}
          #  Chromatic projectToken, refer to the manage page to obtain it.
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
          autoAcceptChanges: 'main'