{"id":6829,"date":"2025-07-31T10:01:22","date_gmt":"2025-07-31T02:01:22","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6829"},"modified":"2025-07-31T10:01:22","modified_gmt":"2025-07-31T02:01:22","slug":"github-%e7%9a%84-dependabot-%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6829","title":{"rendered":"Github \u7684 Dependabot \u4ecb\u7ecd"},"content":{"rendered":"<p>GitHub \u7684 Dependabot \u662f\u4e00\u4e2a\u81ea\u52a8\u5316\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u4e8e<strong>\u76d1\u63a7\u9879\u76ee\u4f9d\u8d56\u9879\uff08\u5982\u5e93\u3001\u6846\u67b6\u3001\u5de5\u5177\u7b49\uff09\u7684\u66f4\u65b0<\/strong>\uff0c\u5e76\u5728\u53d1\u73b0\u65b0\u7248\u672c\u65f6\u81ea\u52a8\u521b\u5efa Pull Request\uff08PR\uff09\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u56e2\u961f\u53ca\u65f6\u66f4\u65b0\u4f9d\u8d56\uff0c\u964d\u4f4e\u5b89\u5168\u98ce\u9669\u548c\u6280\u672f\u503a\u52a1\u3002<\/p>\n<h3>\u4e00\u3001Dependabot \u7684\u6838\u5fc3\u529f\u80fd<\/h3>\n<ol>\n<li>\n<p><strong>\u81ea\u52a8\u68c0\u6d4b\u4f9d\u8d56\u66f4\u65b0<\/strong><br \/>\n\u76d1\u63a7\u9879\u76ee\u4e2d <code>package.json<\/code>\uff08npm\uff09\u3001<code>requirements.txt<\/code>\uff08Python\uff09\u3001<code>pom.xml<\/code>\uff08Maven\uff09\u7b49\u914d\u7f6e\u6587\u4ef6\u4e2d\u58f0\u660e\u7684\u4f9d\u8d56\uff0c\u5f53\u4f9d\u8d56\u53d1\u5e03\u65b0\u7248\u672c\u65f6\uff08\u5982\u5b89\u5168\u8865\u4e01\u3001\u529f\u80fd\u66f4\u65b0\uff09\uff0cDependabot \u4f1a\u81ea\u52a8\u8bc6\u522b\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u81ea\u52a8\u521b\u5efa\u66f4\u65b0 PR<\/strong><br \/>\n\u5bf9\u4e8e\u53ef\u66f4\u65b0\u7684\u4f9d\u8d56\uff0cDependabot \u4f1a\u751f\u6210\u5305\u542b\u7248\u672c\u66f4\u65b0\u7684 PR\uff0c\u5e76\u5728 PR \u4e2d\u8bf4\u660e\u66f4\u65b0\u5185\u5bb9\uff08\u5982\u53d8\u66f4\u65e5\u5fd7\u3001\u5b89\u5168\u98ce\u9669\u4fee\u590d\u7b49\uff09\uff0c\u65b9\u4fbf\u56e2\u961f\u5ba1\u6838\u548c\u5408\u5e76\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u652f\u6301\u591a\u79cd\u4f9d\u8d56\u7c7b\u578b<\/strong><br \/>\n\u8986\u76d6\u4e3b\u6d41\u8bed\u8a00\u548c\u5305\u7ba1\u7406\u5668\uff0c\u5982 npm\u3001Python\u3001Java\u3001Ruby\u3001Docker\u3001GitHub Actions \u7b49\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u5168\u4f18\u5148<\/strong><br \/>\n\u4f18\u5148\u63d0\u9192\u5b89\u5168\u76f8\u5173\u7684\u4f9d\u8d56\u66f4\u65b0\uff08\u5982\u4fee\u590d\u6f0f\u6d1e\u7684\u7248\u672c\uff09\uff0c\u5e2e\u52a9\u56e2\u961f\u5feb\u901f\u54cd\u5e94\u5b89\u5168\u8b66\u62a5\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u53ef\u5b9a\u5236\u66f4\u65b0\u7b56\u7565<\/strong><br \/>\n\u5141\u8bb8\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\uff08<code>.github\/dependabot.yml<\/code>\uff09\u6307\u5b9a\u66f4\u65b0\u9891\u7387\uff08\u5982\u6bcf\u5929\u3001\u6bcf\u5468\uff09\u3001\u76ee\u6807\u5206\u652f\u3001\u5ffd\u7565\u7684\u7248\u672c\u7b49\u3002<\/p>\n<\/li>\n<\/ol>\n<h3>\u4e8c\u3001\u5b9e\u73b0\u539f\u7406<\/h3>\n<p>Dependabot \u7684\u5de5\u4f5c\u6d41\u7a0b\u53ef\u5206\u4e3a\u4ee5\u4e0b\u51e0\u4e2a\u6838\u5fc3\u6b65\u9aa4\uff1a<\/p>\n<h4>1. <strong>\u76d1\u63a7\u4f9d\u8d56\u7248\u672c<\/strong><\/h4>\n<ul>\n<li><strong>\u5b9a\u671f\u626b\u63cf<\/strong>\uff1a\u6839\u636e\u914d\u7f6e\u7684\u9891\u7387\uff08\u5982\u6bcf\u5929\uff09\uff0cDependabot \u4f1a\u5b9a\u671f\u68c0\u67e5\u9879\u76ee\u4f9d\u8d56\u914d\u7f6e\u6587\u4ef6\uff08\u5982 <code>package.json<\/code>\uff09\u3002<\/li>\n<li><strong>\u6bd4\u5bf9\u7248\u672c\u6e90<\/strong>\uff1a\u5bf9\u4e8e\u6bcf\u4e2a\u4f9d\u8d56\uff0cDependabot \u4f1a\u67e5\u8be2\u5176\u5b98\u65b9\u4ed3\u5e93\u6216\u5305\u7ba1\u7406\u5668\u7684\u5143\u6570\u636e\uff08\u5982 npm \u4ed3\u5e93\u7684 <code>registry.npmjs.org<\/code>\uff09\uff0c\u83b7\u53d6\u6700\u65b0\u7248\u672c\u4fe1\u606f\u3002<\/li>\n<li><strong>\u7248\u672c\u517c\u5bb9\u6027\u5224\u65ad<\/strong>\uff1a\u6839\u636e\u8bed\u4e49\u5316\u7248\u672c\u89c4\u5219\uff08SemVer\uff09\u5224\u65ad\u66f4\u65b0\u662f\u5426\u517c\u5bb9\uff08\u5982 <code>1.2.3<\/code> \u2192 <code>1.2.4<\/code> \u662f\u8865\u4e01\u66f4\u65b0\uff0c\u901a\u5e38\u517c\u5bb9\uff1b<code>1.2.3<\/code> \u2192 <code>2.0.0<\/code> \u662f\u4e3b\u7248\u672c\u66f4\u65b0\uff0c\u53ef\u80fd\u4e0d\u517c\u5bb9\uff09\u3002<\/li>\n<\/ul>\n<h4>2. <strong>\u751f\u6210\u66f4\u65b0 PR<\/strong><\/h4>\n<ul>\n<li><strong>\u521b\u5efa\u4e34\u65f6\u5206\u652f<\/strong>\uff1a\u5f53\u53d1\u73b0\u53ef\u66f4\u65b0\u7684\u4f9d\u8d56\u65f6\uff0cDependabot \u4f1a\u5728\u9879\u76ee\u4ed3\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u5206\u652f\uff08\u5982 <code>dependabot\/npm_and_yarn\/lodash-4.17.21<\/code>\uff09\u3002<\/li>\n<li><strong>\u4fee\u6539\u4f9d\u8d56\u914d\u7f6e<\/strong>\uff1a\u5728\u4e34\u65f6\u5206\u652f\u4e2d\uff0c\u81ea\u52a8\u66f4\u65b0\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u4f9d\u8d56\u7248\u672c\u53f7\u3002<\/li>\n<li><strong>\u8fd0\u884c\u81ea\u52a8\u5316\u6d4b\u8bd5<\/strong>\uff1a\u89e6\u53d1\u9879\u76ee\u7684 CI \u6d41\u6c34\u7ebf\uff08\u5982 GitHub Actions\uff09\uff0c\u9a8c\u8bc1\u66f4\u65b0\u540e\u7684\u4f9d\u8d56\u662f\u5426\u5bfc\u81f4\u6d4b\u8bd5\u5931\u8d25\u3002<\/li>\n<li><strong>\u751f\u6210 PR \u4fe1\u606f<\/strong>\uff1aPR \u4e2d\u4f1a\u5305\u542b\u66f4\u65b0\u524d\u540e\u7684\u7248\u672c\u5bf9\u6bd4\u3001\u4f9d\u8d56\u7684\u53d8\u66f4\u65e5\u5fd7\u94fe\u63a5\u3001\u5b89\u5168\u4fee\u590d\u8be6\u60c5\uff08\u5982\u5173\u8054\u7684 CVE \u7f16\u53f7\uff09\u7b49\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u8bc4\u4f30\u3002<\/li>\n<\/ul>\n<h4>3. <strong>\u5904\u7406\u540e\u7eed\u64cd\u4f5c<\/strong><\/h4>\n<ul>\n<li><strong>\u81ea\u52a8\u5408\u5e76\uff08\u53ef\u9009\uff09<\/strong>\uff1a\u5982\u679c\u914d\u7f6e\u4e86\u201c\u81ea\u52a8\u5408\u5e76\u201d\u4e14\u6d4b\u8bd5\u901a\u8fc7\uff0cDependabot \u53ef\u81ea\u52a8\u5c06 PR \u5408\u5e76\u5230\u76ee\u6807\u5206\u652f\u3002<\/li>\n<li><strong>\u51b2\u7a81\u5904\u7406<\/strong>\uff1a\u82e5\u66f4\u65b0\u5206\u652f\u4e0e\u76ee\u6807\u5206\u652f\u5b58\u5728\u51b2\u7a81\uff0cDependabot \u4f1a\u5c1d\u8bd5\u81ea\u52a8\u89e3\u51b3\uff0c\u6216\u5728 PR \u4e2d\u63d0\u793a\u9700\u8981\u624b\u52a8\u5904\u7406\u3002<\/li>\n<li><strong>\u66f4\u65b0\u9891\u7387\u63a7\u5236<\/strong>\uff1a\u901a\u8fc7\u914d\u7f6e\u907f\u514d\u9891\u7e41\u66f4\u65b0\uff08\u5982\u4ec5\u6bcf\u5468\u68c0\u67e5\u4e00\u6b21\uff09\uff0c\u51cf\u5c11\u5bf9\u5f00\u53d1\u6d41\u7a0b\u7684\u5e72\u6270\u3002<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u914d\u7f6e\u793a\u4f8b\uff08<code>.github\/dependabot.yml<\/code>\uff09<\/h3>\n<p>\u4e00\u4e2a\u7b80\u5355\u7684\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b\uff0c\u6307\u5b9a\u6bcf\u5468\u68c0\u67e5 npm \u4f9d\u8d56\u7684\u66f4\u65b0\uff1a<\/p>\n<pre><code class=\"language-yaml\">version: 2\nupdates:\n  - package-ecosystem: &quot;npm&quot;  # \u5305\u7ba1\u7406\u5668\u7c7b\u578b\n    directory: &quot;\/&quot;            # \u914d\u7f6e\u6587\u4ef6\u6240\u5728\u76ee\u5f55\n    schedule:\n      interval: &quot;weekly&quot;      # \u6bcf\u5468\u68c0\u67e5\u4e00\u6b21\n    open-pull-requests-limit: 10  # \u6700\u591a\u540c\u65f6\u6253\u5f0010\u4e2aPR\n    target-branch: &quot;develop&quot;  # \u76ee\u6807\u5206\u652f<\/code><\/pre>\n<h3>\u603b\u7ed3<\/h3>\n<p>Dependabot \u901a\u8fc7<strong>\u81ea\u52a8\u5316\u4f9d\u8d56\u76d1\u63a7\u3001\u7248\u672c\u6bd4\u5bf9\u548c PR \u751f\u6210<\/strong>\uff0c\u89e3\u51b3\u4e86\u624b\u52a8\u66f4\u65b0\u4f9d\u8d56\u7684\u7e41\u7410\u95ee\u9898\uff0c\u5c24\u5176\u5728\u5927\u578b\u9879\u76ee\u4e2d\u80fd\u663e\u8457\u964d\u4f4e\u5b89\u5168\u98ce\u9669\uff08\u53ca\u65f6\u4fee\u590d\u6f0f\u6d1e\uff09\u548c\u7ef4\u62a4\u6210\u672c\uff08\u907f\u514d\u4f9d\u8d56\u8fc7\u65f6\uff09\u3002\u5176\u6838\u5fc3\u4ef7\u503c\u5728\u4e8e\u5c06\u201c\u4f9d\u8d56\u7ba1\u7406\u201d\u4ece\u88ab\u52a8\u54cd\u5e94\u8f6c\u4e3a\u4e3b\u52a8\u9884\u9632\uff0c\u662f\u73b0\u4ee3 CI\/CD \u6d41\u7a0b\u4e2d\u7684\u91cd\u8981\u5de5\u5177\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GitHub \u7684 Dependabot \u662f\u4e00\u4e2a\u81ea\u52a8\u5316\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u4e8e\u76d1\u63a7\u9879\u76ee\u4f9d\u8d56\u9879\uff08\u5982\u5e93\u3001\u6846\u67b6\u3001\u5de5\u5177\u7b49\uff09\u7684\u66f4\u65b0\uff0c&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6829\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[159],"tags":[],"class_list":["post-6829","post","type-post","status-publish","format-standard","hentry","category-159"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6829"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6829\/revisions"}],"predecessor-version":[{"id":6830,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6829\/revisions\/6830"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}