如何自动接受主分支的彩色 github 工作流程中的更改?
Posted
技术标签:
【中文标题】如何自动接受主分支的彩色 github 工作流程中的更改?【英文标题】:How to auto accept changes in chromatic github workflow for main branch? 【发布时间】:2021-04-08 09:33:30 【问题描述】:在 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
。
【问题讨论】:
【参考方案1】:您有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'
【讨论】:
@Rashomon 如果我的回复对您有帮助,您可以考虑点赞吗?以上是关于如何自动接受主分支的彩色 github 工作流程中的更改?的主要内容,如果未能解决你的问题,请参考以下文章
如何创建从一个分支的 Bitbucket 到 GitHub 中的主分支的合并拉取请求