如何仅在拉取请求分支的头提交上运行 github 操作?

发布于 2025-01-18 04:18:44 字数 532 浏览 3 评论 0 原文

有没有办法只能在功能分支的头部提交的拉动请求期间运行检查?

例如,如果我的分支看起来像这样:

  • ticket-123:做一些工作
  • 修复
  • 程序修复
  • 单元测试

,我希望此GitHub操作仅在ticket-123上运行:

目前做一些工作,我

name: 'Pull Request Commit Linter'
on: 
- pull_request

jobs:
  commitlint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: wagoid/commitlint-github-action@v4

尝试使用Fetch-Depth,使用1和2,但这无效。有建议吗?

Is there a way to run a check during a pull request only on the head commit of a feature branch?

For example, if my branch looks like this:

  • TICKET-123: Doing some work
  • fix
  • fix
  • unit test

I want this GitHub action to only run on TICKET-123: Doing some work

Currently, I have

name: 'Pull Request Commit Linter'
on: 
- pull_request

jobs:
  commitlint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: wagoid/commitlint-github-action@v4

I tried playing with fetch-depth, using 1 and 2, but that did not work. Any advice?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羁拥 2025-01-25 04:18:44

您应该删除 fetch-depth:0 定义,因为我查找 repo,我在下面找到:

有必要将提取深度参数指定为
操作/结帐@V2步骤。默认情况下,他们仅获取最新的提交
分支机构,但我们需要更多的提交,因为我们验证了一定范围
提交消息。

如果您仅获取最新的提交,您的问题将得到解决。

You should remove fetch-depth: 0 definition because I looked up the https://github.com/wagoid/commitlint-github-action repo and I found below sentence:

It's necessary that you specify the fetch-depth argument to
actions/checkout@v2 step. By default they fetch only latest commit of
the branch, but we need more commits since we validate a range of
commit messages.

If you fetch the latest commit only, your problem will be solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文