{"id":48367,"date":"2023-02-18T12:09:35","date_gmt":"2023-11-14T16:15:23","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/"},"modified":"2024-04-29T15:08:05","modified_gmt":"2024-04-29T07:08:05","slug":"%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/","title":{"rendered":"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406"},"content":{"rendered":"<p>\u6709\u4e24\u79cd\u5927\u81f4\u7684\u65b9\u6cd5\u53ef\u4ee5\u91cd\u65b0\u5229\u7528\u81ea\u5df1\u7f16\u5199\u7684 GitHub Actions \u5904\u7406\uff1a<\/p>\n<p>1. \u65b9\u6cd5\u4e00\uff1a\u628a\u81ea\u5df1\u7f16\u5199\u7684 GitHub Actions \u5904\u7406\u5b58\u50a8\u5230\u4e00\u4e2a\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u6a21\u5757\u4e2d\uff0c\u4ee5\u4fbf\u5176\u4ed6\u9879\u76ee\u53ef\u4ee5\u8f7b\u677e\u5f15\u7528\u548c\u8c03\u7528\u8be5\u6a21\u5757\u3002<\/p>\n<p>2. \u65b9\u6cd5\u4e8c\uff1a\u5c06\u81ea\u5df1\u7f16\u5199\u7684 GitHub Actions \u5904\u7406\u8f6c\u5316\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684\u5de5\u5177\u6216\u63d2\u4ef6\uff0c\u8ba9\u5176\u4ed6\u9879\u76ee\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5\u548c\u914d\u7f6e\u8be5\u5de5\u5177\u6216\u63d2\u4ef6\u6765\u5b9e\u73b0\u76f8\u540c\u7684\u529f\u80fd\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Reusable workflows<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Composite action<\/ul>\n<p>\u7531\u4e8e GitHub Actions \u7684 yaml \u6587\u4ef6\u4f1a\u53d8\u5f97\u5e9e\u5927\u4e14\u96be\u4ee5\u9605\u8bfb\u548c\u7ef4\u62a4\uff0c\u6240\u4ee5\u4e3a\u4e86\u4fdd\u6301\u4e00\u4e2a\u548c\u5e73\u7684\u73af\u5883\uff0c\u5fc5\u987b\u52aa\u529b\u4fdd\u6301\u9002\u5ea6\u7684\u5927\u5c0f\uff0c\u5e76\u8fdb\u884c\u9002\u5f53\u7684\u6a21\u5757\u5206\u89e3\u548c\u91cd\u7528\u3002\u6211\u4eca\u5e74\u9047\u5230\u4e86\u7c7b\u4f3c\u7684\u60c5\u51b5\uff0c\u56e0\u6b64\u6211\u628a\u5b83\u6574\u7406\u6210\u4e86\u4e00\u7bc7\u6587\u7ae0\u3002<\/p>\n<h2>&#8220;\u91cd\u65b0\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u662f\u4ec0\u4e48\uff1f&#8221;<\/h2>\n<p>&nbsp;<\/p>\n<p>\u6839\u636e\u8bed\u8a00\u7684\u5e38\u89c4\uff0c\u8fd9\u662f\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u3002\u4e3a\u4e86\u9632\u6b62\u5728\u6bcf\u4e2a\u5b58\u50a8\u5e93\u4e2d\u586b\u5199 GitHub Actions \u7684\u5b9a\u4e49\uff0c\u5e76\u4e14\u56e0\u6b64\u4ea7\u751f\u4e86\u5197\u957f\u7684\u548c\u6563\u843d\u5728\u5404\u5904\u7684\u4ee3\u7801\uff0c\u5bfc\u81f4\u4e86\u590d\u5236\u7c98\u8d34\u7684\u6df7\u4e71\uff0c\u6211\u4eec\u5e0c\u671b\u5c06\u5171\u540c\u7684\u5b9a\u4e49\u62c6\u5206\u51fa\u6765\u5e76\u5916\u90e8\u8c03\u7528\u3002\u4e3a\u6b64\uff0c\u6211\u4eec\u6709\u4e86\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u673a\u5236\u3002<\/p>\n<p>\u7ecf\u5386\u4e86\u4e00\u4e9b\u89c4\u8303\u548c\u73af\u5883\u7684\u53d8\u8fc1\u4e4b\u540e\uff0c\u4ece\u73b0\u5728\u5f00\u59cb\uff082022\u5e7412\u6708\u4e4b\u540e\uff09\uff0c\u53ef\u4ee5\u8c03\u7528\u5b58\u653e\u5728\u53e6\u4e00\u4e2a\u79c1\u6709\u4ed3\u5e93\u4e2d\u7684\u64cd\u4f5c\u3002\u672c\u6587\u6863\u57fa\u4e8e\u8fd9\u4e2a\u60c5\u51b5\u8fdb\u884c\u63cf\u8ff0\u3002<\/p>\n<h2>\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u8bbe\u7f6e<\/h2>\n<h3>\u4ee3\u7801\u5e93<\/h3>\n<p>\u9700\u8981\u5bf9\u7528\u4e8e\u8bbe\u7f6e GitHub Actions \u6587\u4ef6\u7684\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\u7a0b\u5b58\u50a8\u5e93\u8fdb\u884c\u4ee5\u4e0b\u914d\u7f6e\u3002<br \/>\n\u5982\u679c\u6ca1\u6709\u8fdb\u884c\u8fd9\u4e9b\u914d\u7f6e\uff0c\u5219\u65e0\u6cd5\u8c03\u7528 Actions\u3002<\/p>\n<h4>\u5c06 GitHub Actions \u7684\u8bbf\u95ee\u8bbe\u7f6e\u66f4\u6539\u4e3a\u53ef\u4ee5\u5728~\u4e2d\u7684\u5b58\u50a8\u5e93\u8bbf\u95ee\u3002<\/h4>\n<p>https:\/\/github.com\/(\u7ec4\u7ec7\u540d)\/(\u4ed3\u5e93\u540d)\/\u8bbe\u7f6e\/\u64cd\u4f5c<\/p>\n<p>\u60a8\u53ef\u4ee5\u4ece\u901a\u8fc7\u4e0a\u8ff0URL\u8bbf\u95ee\u7684\u8bbe\u7f6e\u754c\u9762\u4e2d\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c&#8221;Access&#8221;\u7684\u8bbe\u7f6e\u4e3a&#8221;Not accessible&#8221;\uff0c\u6240\u4ee5\u6211\u4eec\u5c06\u5176\u66f4\u6539\u4e3a\u5728&#8221;xxxxxx&#8221;\u7ec4\u7ec7\u7684\u5b58\u50a8\u5e93\u4e2d\u53ef\u8bbf\u95ee\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d84ed913a08637a6b7949\/14-0.png\" alt=\"image.png\" \/><\/div>\n<h3>Github Actions \u6587\u4ef6<\/h3>\n<p>\u5fc5\u987b\u6839\u636e\u53ef\u91cd\u590d\u4f7f\u7528\u5de5\u4f5c\u6d41\u7684\u89c4\u8303\u6765\u63cf\u8ff0Actions\u6587\u4ef6\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.github\/workflows \u914d\u4e0b\u306b\u8a2d\u7f6e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210\u3082\u57fa\u672c\u7684\u306b\u4e0d\u53ef<\/p>\n<p>\u547c\u3073\u51fa\u3057\u306e\u5b9a\u7fa9\u3068\u3057\u3066 on: workflow_call: \u306e\u5b9a\u7fa9\u3092\u5fc5\u305a\u3064\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b<\/p>\n<pre class=\"post-pre\"><code>on:\r\n  workflow_call:\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u305d\u306e\u4ed6\u3001Reusable workflows \u306e\u8a73\u7d30\u306a\u4ed5\u69d8\u306b\u3064\u3044\u3066\u306f\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u7167\u304f\u3060\u3055\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>https:\/\/docs.github.com\/ja\/actions\/using-workflows\/reusing-workflows<\/p>\n<h4>\u8bb0\u8ff0\u7684\u793a\u4f8b<\/h4>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u5728 GitHub Actions \u7684 Lint \u5de5\u5177 actionlint \u4e2d\u6267\u884c\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u7a0b\u3002<\/p>\n<pre class=\"post-pre\"><code>on:\r\n  workflow_call:\r\n    inputs:\r\n      os:\r\n        default: ubuntu-latest\r\n        required: false\r\n        type: string\r\n\r\njobs:\r\n  actionlint:\r\n    runs-on: ${{ inputs.os }}\r\n    steps:\r\n      - uses: actions\/checkout@v4\r\n      - name: Run actionlint\r\n        shell: bash\r\n        run: |\r\n          bash &lt;(curl https:\/\/raw.githubusercontent.com\/rhysd\/actionlint\/main\/scripts\/download-actionlint.bash)\r\n          .\/actionlint -color\r\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u4f7f\u7528\u53ef\u91cd\u590d\u7684\u5de5\u4f5c\u6d41\u7a0b\uff0c\u60a8\u9700\u8981\u63d0\u4f9b on: workflow_call\u6307\u4ee4\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u901a\u8fc7\u8f93\u5165\u6307\u5b9a\u7684\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\uff08\u9ed8\u8ba4\u4e3a ubuntu-latest\uff09\u4e0a\u8fd0\u884c rhysd\/actionlint\u3002<\/p>\n<h2>\u8c03\u7528\u53ef\u590d\u7528\u7684\u5de5\u4f5c\u6d41<\/h2>\n<h3>\u63cf\u8ff0\u793a\u4f8b<\/h3>\n<p>\u5047\u8bbe\u4e0a\u8ff0\u9002\u7528\u4e8e actionslint \u7684\u53ef\u91cd\u590d\u5de5\u4f5c\u6d41\u6587\u4ef6\u88ab\u653e\u7f6e\u5728 (\u673a\u6784)\/github-actions\/.github\/workflows\/actionlint.yml \u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u8c03\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code>name: Actionlint\r\non:\r\n  pull_request:\r\n\r\njobs:\r\n  actionlint:\r\n    uses: (organization)\/github-actions\/.github\/workflows\/actionlint.yml@main\r\n<\/code><\/pre>\n<p>\u4f7f\u7528\u201c\u306b\u306f\u201d\uff0c\u4ee5\u4ee5\u4e0b\u7684\u683c\u5f0f\u6307\u5b9a\u8981\u8c03\u7528\u7684 Actions \u6587\u4ef6\u3002<\/p>\n<blockquote><p>\uff08\u7ec4\u7ec7\/\u4ed3\u5e93\uff09\/ .github \/ workflows \/ \uff08\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\u6587\u4ef6\uff09@\uff08\u5206\u652f\u540d\u79f0\uff09<\/p><\/blockquote>\n<p>\u5982\u679c\u8981\u5411\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u7a0b\u4f20\u9012\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528`with`\u6216`secrets`\u7b49\u6307\u5b9a\u4f20\u9012\u3002<\/p>\n<p>\u53ef\u4ee5\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u5c06\u5728\u5404\u4e2a\u5730\u65b9\u5b9e\u65bd\u7684\u5171\u540c\u5904\u7406\u4f5c\u4e3a\u53ef\u4ee5\u91cd\u7528\u7684\u5de5\u4f5c\u6d41\u5265\u79bb\u51fa\u6765\u3002<br \/>\nReusable workflows \u662f\u65e9\u5c31\u5b58\u5728\u7684\u529f\u80fd\uff0c\u4f46\u4ece2023\u5e74\uff082022\u5e7412\u6708\u81f3\u4eca\uff09\u7684\u4e3b\u9898\u6765\u770b\uff0c\u6211\u8ba4\u4e3a\u5176\u91cd\u8981\u4e4b\u5904\u5728\u4e8e\u53ef\u4ee5\u8c03\u7528\u5176\u4ed6\u653e\u7f6e\u5728\u79c1\u6709\u4ed3\u5e93\u4e2d\u7684\u5de5\u4f5c\u6d41\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u5176\u4fbf\u5229\u6027\u3002<\/p>\n<h2>\u4ec0\u4e48\u662f\u590d\u5408\u52a8\u4f5c\uff1f<\/h2>\n<p>&nbsp;<\/p>\n<p>\u53ef\u4ee5\u8fd9\u6837\u6765\u89e3\u91ca\uff0c\u5b83\u662f\u6307\u5c06\u7531\u591a\u4e2a\u6b65\u9aa4\u7ec4\u6210\u7684\u8fc7\u7a0b\u8fdb\u884c\u5206\u5272\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a\u53ef\u91cd\u590d\u4f7f\u7528\u7684 Action\u3002<\/p>\n<p>\u4e0e\u53ef\u91cd\u590d\u4f7f\u7528\u7684\u5de5\u4f5c\u6d41\u7a0b\u7c7b\u4f3c\uff0c\u60a8\u73b0\u5728\u53ef\u4ee5\u8c03\u7528\u5b58\u653e\u5728\u53e6\u4e00\u4e2a\u79c1\u6709\u5b58\u50a8\u5e93\u4e2d\u7684\u64cd\u4f5c\u3002\u672c\u6587\u6863\u662f\u5728\u6b64\u60c5\u51b5\u4e0b\u64b0\u5199\u7684\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u6211\u8ba4\u4e3a\u53ef\u4ee5\u5c06 \u53ef\u91cd\u590d\u5229\u7528\u7684\u5de5\u4f5c\u6d41\u4e0e\u590d\u5408\u64cd\u4f5c\u7684\u533a\u522b\u5f52\u7eb3\u5982\u4e0b\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Reusable workflows: workflow \u306e\u51e6\u7406\u3092\u5207\u308a\u51fa\u3057\u3066\u518d\u5229\u7528\u5316\u3067\u304d\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Composite action: \u8907\u6570\u306e step \u306e\u51e6\u7406\u3092\u5207\u308a\u51fa\u3057\u3066\u518d\u5229\u7528\u5316\u3067\u304d\u308b\u3002<\/ul>\n<h2>\u8bbe\u7f6e\u7efc\u5408\u52a8\u4f5c<\/h2>\n<h3>Github Actions \u6587\u4ef6<\/h3>\n<p>\u9700\u8981\u6839\u636e Composite Action \u7684\u89c4\u8303\u6765\u63cf\u8ff0 Actions \u6587\u4ef6\u3002<\/p>\n<ul class=\"post-ul\">\u547c\u3073\u51fa\u3057\u306e\u5b9a\u7fa9\u3068\u3057\u3066 runs: using:composite \u306e\u5b9a\u7fa9\u3092\u5fc5\u305a\u3064\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b<\/ul>\n<pre class=\"post-pre\"><code>runs:\r\n  using: composite\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Reusable workflow \u3068\u7570\u306a\u308a\u3001Composite action \u306f\u6240\u5b9a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u4e2d\u306b\u5358\u4e00\u3082\u3057\u304f\u306f\u8907\u6570\u306e Action \u5b9a\u7fa9 yaml \u3092\u8a2d\u7f6e\u3059\u308b\u5f62\u306b\u306a\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Composite action \u3078\u5024\u3092\u6e21\u3059\u6642\u306f Composite action \u5074\u3067 inputs \u3092\u5b9a\u7fa9\u3059\u308b\u3002<\/ul>\n<pre class=\"post-pre\"><code>inputs:\r\n  some_value:\r\n    required: true\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Reusable workflow \u3068\u7570\u306a\u308a\u3001Composite action \u3067\u306f secrets \u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>\u305d\u306e\u4ed6\u3001Composite actions \u306e\u4ed5\u69d8\u306b\u3064\u3044\u3066\u306f\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u7167\u304f\u3060\u3055\u3044<\/p>\n<p>https:\/\/docs.github.com\/ja\/actions\/creating-actions\/creating-a-composite-action<\/p>\n<h3>\u89c4\u8303\uff08\u7ec4\u7ec7\u7279\u5b9a\u7684\uff09<\/h3>\n<p>\u8fd9\u662f\u6211\u4eec\u7ec4\u7ec7\u7684\u7279\u5b9a\u60c5\u51b5\uff0c\u4f46\u76f8\u5173\u7684 Composite action \u6587\u4ef6\u5c06\u653e\u7f6e\u5728 .github\/composite \u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u8fd9\u4e2a\u539f\u56e0\u662f\u56e0\u4e3a\u76ee\u524d actionlint \u4e0d\u652f\u6301 Composite action \u683c\u5f0f\uff0c\u5982\u679c\u8ba9 actionlint \u52a0\u8f7d\u8fd9\u4e9b\u6587\u4ef6\uff0c\u5c31\u4f1a\u51fa\u9519\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u7531\u4e8e\u60f3\u8981\u5c06.github\/workflows\u4f5c\u4e3aactionlint\u7684\u76ee\u6807\uff0c\u56e0\u6b64\u6211\u4eec\u91c7\u53d6\u4e86\u4e0a\u8ff0\u64cd\u4f5c\u4f5c\u4e3a\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<h3>\u63cf\u8ff0\u793a\u4f8b<\/h3>\n<p>\u4e3e\u4f8b\u6765\u8bf4\uff0c\u6211\u4eec\u53ef\u4ee5\u521d\u59cb\u5316Terraform\u73af\u5883\u5e76\u6267\u884c\u8ba1\u5212\u7684\u590d\u5408\u64cd\u4f5c\u3002<\/p>\n<pre class=\"post-pre\"><code>name: terraform-plan\r\ndescription: terraform-plan\r\ninputs:\r\n  terraform_version:\r\n    required: true\r\nruns:\r\n  using: composite\r\n  steps:\r\n    - name: setup terraform\r\n      uses: hashicorp\/setup-terraform@v2\r\n      with:\r\n        terraform_version: ${{ inputs.terraform_version }}\r\n\r\n    - name: terraform fmt\r\n      id: fmt\r\n      shell: bash\r\n      run: terraform fmt -check\r\n\r\n    - name: terraform init\r\n      id: init\r\n      shell: bash\r\n      run: terraform init\r\n\r\n    - name: terraform validate\r\n      id: validate\r\n      shell: bash\r\n      run: terraform validate -no-color\r\n\r\n    - name: terraform plan\r\n      id: plan\r\n      shell: bash\r\n      run: terraform plan -no-color\r\n<\/code><\/pre>\n<p>\u6211\u5df2\u5b89\u88c5terraform\uff0c\u5e76\u6267\u884c\u4e86\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">terraform fmt<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">terraform init<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">terraform validate<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">terraform plan<\/ul>\n<h2>\u8c03\u7528\u590d\u5408\u52a8\u4f5c<\/h2>\n<h3>\u63cf\u8ff0\u5b9e\u4f8b<\/h3>\n<p>\u5982\u679c\u4ee5 Terraform \u76f8\u5173\u7684 Composite Action \u4e3e\u4f8b\uff0c\u90a3\u4e48\u5728\u8c03\u7528\u8005\u65b9\u9762\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u63cf\u8ff0\u8fdb\u884c\u8c03\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code>      - name: terraform plan\r\n        uses: (organization)\/github-actions\/.github\/composite\/terraform-plan@main\r\n        with:\r\n          terraform_version: 1.6.5\r\n<\/code><\/pre>\n<p>\u8bf7\u4ee5\u4ee5\u4e0b\u7684\u683c\u5f0f\u6307\u5b9a\u8981\u8c03\u7528\u7684 Actions \u6587\u4ef6\u3002<\/p>\n<blockquote><p>\uff08\u7ec4\u7ec7\uff09\/\uff08\u4ed3\u5e93\uff09\/ .github\/composite\/\uff08\u7ec4\u5408\u64cd\u4f5c\u76ee\u5f55\uff09@(\u5206\u652f\u540d)<\/p><\/blockquote>\n<p>\u5728\u4f20\u9012\u503c\u7ed9Composite action\u65f6\uff0c\u4e00\u4e2a\u91cd\u8981\u7684\u6ce8\u610f\u4e8b\u9879\u662f\u8981\u4f7f\u7528with\u8fdb\u884c\u4f20\u9012\u3002\u539f\u56e0\u662f\u56e0\u4e3a\u5728\u5f53\u524d\u60c5\u51b5\u4e0b\uff0csecrets\u5728Composite action\u4e2d\u5c1a\u4e0d\u53d7\u652f\u6301\uff0c\u6240\u4ee5\u53ea\u80fd\u901a\u8fc7with\u5b9e\u73b0\u503c\u4f20\u9012\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u76ee\u524d\u4e3a\u6b62\uff0c\u5728\u516c\u53f8\u5185\u90e8\u8fd8\u6ca1\u6709\u9047\u5230\u9700\u8981\u8fdb\u884c\u5982\u6b64\u5b89\u5168\u7684\u503c\u4ea4\u6362\u7684\u8981\u6c42\uff0c\u4f46\u6211\u89c9\u5f97\u62d2\u7edd\u91c7\u7528\u4e0a\u8ff0\u89c4\u8303\u5e76\u9009\u62e9\u4e0d\u4f7f\u7528\u590d\u5408\u52a8\u4f5c\u7684\u9009\u62e9\u4e5f\u662f\u53ef\u80fd\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e24\u79cd\u5927\u81f4\u7684\u65b9\u6cd5\u53ef\u4ee5\u91cd\u65b0\u5229\u7528\u81ea\u5df1\u7f16\u5199\u7684 GitHub Actions \u5904\u7406\uff1a 1. \u65b9\u6cd5\u4e00\uff1a\u628a\u81ea\u5df1\u7f16\u5199\u7684 Gi [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-48367","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41-\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528-github-actions-\u7684\u5904\u7406\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406\" \/>\n<meta property=\"og:description\" content=\"\u6709\u4e24\u79cd\u5927\u81f4\u7684\u65b9\u6cd5\u53ef\u4ee5\u91cd\u65b0\u5229\u7528\u81ea\u5df1\u7f16\u5199\u7684 GitHub Actions \u5904\u7406\uff1a 1. \u65b9\u6cd5\u4e00\uff1a\u628a\u81ea\u5df1\u7f16\u5199\u7684 Gi [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41-\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528-github-actions-\u7684\u5904\u7406\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-14T16:15:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T07:08:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d84ed913a08637a6b7949\/14-0.png\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/\",\"name\":\"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-11-14T16:15:23+00:00\",\"dateModified\":\"2024-04-29T07:08:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41-\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528-github-actions-\u7684\u5904\u7406\/","og_locale":"zh_CN","og_type":"article","og_title":"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406","og_description":"\u6709\u4e24\u79cd\u5927\u81f4\u7684\u65b9\u6cd5\u53ef\u4ee5\u91cd\u65b0\u5229\u7528\u81ea\u5df1\u7f16\u5199\u7684 GitHub Actions \u5904\u7406\uff1a 1. \u65b9\u6cd5\u4e00\uff1a\u628a\u81ea\u5df1\u7f16\u5199\u7684 Gi [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41-\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528-github-actions-\u7684\u5904\u7406\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-11-14T16:15:23+00:00","article_modified_time":"2024-04-29T07:08:05+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d84ed913a08637a6b7949\/14-0.png"}],"author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/","name":"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-11-14T16:15:23+00:00","dateModified":"2024-04-29T07:08:05+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u901a\u8fc7\u4f7f\u7528\u53ef\u91cd\u7528\u5de5\u4f5c\u6d41\/\u7ec4\u5408\u52a8\u4f5c\u6765\u91cd\u7528 GitHub Actions \u7684\u5904\u7406"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e9%80%9a%e8%bf%87%e4%bd%bf%e7%94%a8%e5%8f%af%e9%87%8d%e7%94%a8%e5%b7%a5%e4%bd%9c%e6%b5%81-%e7%bb%84%e5%90%88%e5%8a%a8%e4%bd%9c%e6%9d%a5%e9%87%8d%e7%94%a8-github-actions-%e7%9a%84%e5%a4%84%e7%90%86\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/48367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=48367"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/48367\/revisions"}],"predecessor-version":[{"id":86006,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/48367\/revisions\/86006"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=48367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=48367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=48367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}