当repo i fork发布新版本时,是否可以运行github动作?

发布于 2025-02-08 14:10:33 字数 41 浏览 1 评论 0原文

每当原始分叉项目发布新版本时,是否可以在叉子上运行github操作?

Is it possible to run GitHub action on a fork, whenever the original forked project publishes a new release ?

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

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

发布评论

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

评论(2

梦纸 2025-02-15 14:10:33

您可以使用[发布]事件,但请注意,多个活动可以触发它。

on:
  release:
    types: [published]

有关每个事件的详细信息,请检查 webhook事件,您需要的是[已发布]和repository键,它是事件发生的存储库。

You can use the [release] event but note that more than one activity can trigger it.

on:
  release:
    types: [published]

For the details of each event check the Webhook events, the one you need is [published] and repository key which is the repository where the event occurs.

伴我老 2025-02-15 14:10:33

从2022年6月开始,当上游(您分叉的存储库)确实某物时,没有触发器运行工作流程。

因此,您要做的就是创建一个在时间表,请拉上上游存储库,并检查是否有新的东西。

如果您只想复制提交1:1,则可以使用Action aormsby/fork-sync-with-with-upstream-action https://github.com/aormsby/fork-sync-sync-with-with-upstream-actream-action

如果标签足够好,您可以接受从上述操作中的灵感,并将存储库中的标签与上游的标签进行比较。

如果您确实需要发行版(GitHub版本),那么您可能必须在某个地方维护一些自定义状态,以记住您已经看到的哪些版本。或者,请在存储库中复制所有上游版本。这将使您能够创建一个单独的工作流程,该工作流程版本,就像这样:

  1. Pull Uppstream Repository
  2. 在您的存储库中重新创建所有上游版本(除非已经存在)
  3. 触发单独的工作流on:prease Release

As of Jun 2022, there is no trigger that runs the workflow when the upstream (the repo you forked) does something.

So what you'll have to do is create a workflow that runs on schedule, pull the upstream repository and check if there is something new.

If you just want to copy commits 1:1, then you could use the action aormsby/Fork-Sync-With-Upstream-action: https://github.com/aormsby/Fork-Sync-With-Upstream-action

If tags are good enough, you could take inspiration from the above action and compare the tags in your repository with the ones from upstream.

If you really need releases (GitHub Releases), then you're probably going to have to maintain some custom state somewhere to remember which releases you have already seen. Or alternatively, replicate all upstream releases in your repository. This would allow you to create a separate workflow that triggers on release, like so:

  1. Pull upstream repository
  2. Recreate all upstream releases in your repository (unless they exist already)
  3. Trigger a separate workflow on: release
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文