gpt4 book ai didi

git - 我如何确保 CircleCi 忽略由 CircleCi 本身引起的对 master 的推送?

转载 作者:太空狗 更新时间:2023-10-29 14:31:04 29 4
gpt4 key购买 nike

CircleCi 在代码被推送到 master 时运行,但是 CircleCi 在名为 Version Package Bump 的运行脚本中推送到 master 本身。因此,在第一次构建之后,将运行第二个。但它失败并显示消息:

On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean Exited with code 1

如何确保 CircleCi 不会因自身引起的推送而再次启动?

jobs:
build:
docker:
- image: circleci/node:8.10.0
branches:
only:
- master
steps:
- add_ssh_keys
- checkout
- run:
name: Keyscan DreamHost (HACK)
command: ssh-keyscan -H HOST >> ~/.ssh/known_hosts
- run:
name: Install Dependencies
command: npm install
- run:
name: Build App
command: npm run build
- run:
name: Verion Package Bump
command: |
git config user.name "circleci"
git config user.email "EMAIL"
git add .
git commit -m "[ci] Generated Build"
npm version patch -m "[ci] Bumped version number to %s"
git push origin master
git push --tags
- deploy:
name: Publish to DreamHost
command: scp -r build/* HOST:./DIRECTORY/

即使我将其包装在条件中,我仍然会看到相同的错误并且构建会发生两次:

if ! git diff-index --quiet HEAD --; then
git config user.name "circleci"
git config user.email "EMAIL"
git add .
git commit -m "[ci] Generated Build"
npm version patch -m "[ci] Bumped version number to %s"
git push origin master
git push --tags
fi

最佳答案

在提交消息的任何位置添加 [ci skip][skip ci] 标签。

参见 https://circleci.com/docs/2.0/skip-build/

替换你的

git commit -m "[ci] Generated Build"

git commit -m "[ci skip] Generated Build"

git commit -m "Generated Build [skip ci]"

关于git - 我如何确保 CircleCi 忽略由 CircleCi 本身引起的对 master 的推送?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54546137/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com