是否应该忽略.github worflow yml文件?

发布于 2025-01-20 11:00:06 字数 93 浏览 5 评论 0原文

希望你们都做得很好:)

这是一个简单的问题,我在网上找不到答案。是否应该将 .github/workflow 操作(yml 文件)添加到 gitignore?

Hope you are all doing great :)

This is a simple question, that I found no answer to, online. Should .github/workflow actions (yml files) be added to gitignore?

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

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

发布评论

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

评论(2

终止放荡 2025-01-27 11:00:06

.gitignore存在,以避免将某些文件投入存储库。

.github/WorkFlow文件通常用于告诉GitHub执行操作。 Github只知道遵守您的存储库的文件

因此,将这些文件添加到您的.gitignore毫无意义,因为您特别希望它们在您的存储库中。

.gitignore exists to avoid committing certain files to the repository.

.github/workflow files are usually used to tell GitHub to execute actions. GitHub only knows about files that are committed to your repository.

Hence, it makes no sense to add those files to your .gitignore since you specifically want them to be in your repository.

初见终念 2025-01-27 11:00:06

我认为答案是

最近,我遇到一个场景,开发人员不小心更改了工作流程,将同一存储库下的两个分支与两个不同的工作流程合并。整个管道破裂,但没有对部署造成任何损害。

因此,如果您不经常更改工作流程,我建议您首先设置工作流程并将其添加到 .gitignore 文件中,这样就不会有人意外提交任何更改。这样做,最初提交的工作流不会从存储库中删除,也不会提交新的更改。但如果您经常进行更改,我建议添加一个 CODEOWNERS 文件并让某些用户批准这些更改。

I think the answer is Yes.

Recently, I encountered a scenario where the developer accidentally changed the workflow and merged two branches under the same repository with two different workflows. The whole pipeline broke but didn't cause any damage to the deployments.

So, if you don't change your workflow frequently, I recommend setting your workflow initially and adding that in your .gitignore file so that no one accidentally commits any changes. Doing so, the initially committed workflow won't get removed from the repository and no new changes will be committed. But if you make frequent changes, I recommend adding a CODEOWNERS file and giving certain users to approve those changes.

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