GitHub Action PR工作流程开发常规

发布于 2025-02-10 05:22:33 字数 486 浏览 1 评论 0原文

我正在研究仅由pull_request事件触发的GitHub操作。 想知道是否有比我目前正在做的更好的“开发经验”。

我的理解是,工作流文件必须位于base分支中。因此,为了测试工作流程更改,我必须将代码推到基本分支,然后通过头部分支触发工作流程。

假设我已经有my-basemy-head分支,并设置了拉请请求。我通过syncronization事件触发工作流程,通过推入头部分支:

git checkout my-base
git add . && git commit -m "plx work" && git push
git checkout my-head
git merge my-base --no-edit && git push

有更好的方法吗?

I'm working on GitHub actions that only get triggered by pull_request events.
Wondering if there is a better "dev experience" than what I'm currently doing.

My understanding is that the workflow file must be in the base branch. So in order to test workflow changes, I gotta push code to the base branch, then trigger the workflow via the head branch.

Assume I've already got my-base and my-head branches, with a pull request set up. I trigger the workflow via syncronization events, by pushing to the head branch:

git checkout my-base
git add . && git commit -m "plx work" && git push
git checkout my-head
git merge my-base --no-edit && git push

Is there a better way?

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

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

发布评论

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

评论(1

羁客 2025-02-17 05:22:33

对于触发pull_request而言,这是不正确的。这足以让此触发器与您的拉请请求相关联的分支 - 无需将其放入基本分支。

pull_request_target需要在基本分支中才能命名一个示例。 -

That's not true for the trigger pull_request. It is enough for this trigger to be on the branch associated with your pull request -- no need to put it in the base branch.

pull_request_target, however, needs to be in the base branch to name an example. –

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