当repo i fork发布新版本时,是否可以运行github动作?
每当原始分叉项目发布新版本时,是否可以在叉子上运行github操作?
Is it possible to run GitHub action on a fork, whenever the original forked project publishes a new release ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用[发布]事件,但请注意,多个活动可以触发它。
有关每个事件的详细信息,请检查 webhook事件,您需要的是[已发布]和
repository
键,它是事件发生的存储库。You can use the [release] event but note that more than one activity can trigger it.
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.从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版本),那么您可能必须在某个地方维护一些自定义状态,以记住您已经看到的哪些版本。或者,请在存储库中复制所有上游版本。这将使您能够创建一个单独的工作流程,该工作流程版本,就像这样:
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-actionIf 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:
on: release