仅在当前COMM包含对某些文件的更改时,如何触发Gitlab CI?

发布于 2025-02-03 07:50:10 字数 437 浏览 4 评论 0原文

我有一个gitlab阶段,我只想在某些文件更改时运行。我尝试使用仅使用> IF:更改...,但是那些不按照我想要的工作。

我希望只有当当前提交(无论是合并请求还是被推到MAIN)时,才会触发此阶段

cache frontend:
  stage: cache
  cache: &frontend_cache
    key: frontend-packages
    paths:
      - frontend/node_modules/
      - frontend/.yarn/
  script:
    - cd frontend
    - yarn install --immutable
  only:
    changes:
      - frontend/yarn.lock

I a have a Gitlab stage that I only want to run if there are changes to some file. I have tried using only and if: changes... however those not work as I want.

I want that this stage is only triggered if the current commit (no matter if it is a merge request or pushed to main) contains changes to some file

My stage:

cache frontend:
  stage: cache
  cache: &frontend_cache
    key: frontend-packages
    paths:
      - frontend/node_modules/
      - frontend/.yarn/
  script:
    - cd frontend
    - yarn install --immutable
  only:
    changes:
      - frontend/yarn.lock

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文