是否应该忽略.github worflow yml文件?
希望你们都做得很好:)
这是一个简单的问题,我在网上找不到答案。是否应该将 .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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
.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.我认为答案是是。
最近,我遇到一个场景,开发人员不小心更改了工作流程,将同一存储库下的两个分支与两个不同的工作流程合并。整个管道破裂,但没有对部署造成任何损害。
因此,如果您不经常更改工作流程,我建议您首先设置工作流程并将其添加到
.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 aCODEOWNERS
file and giving certain users to approve those changes.