我正在關注此檔案: https ://docs.github.com/en/rest/reference/actions#list-repository-workflows
/repos/{owner}/{repo}/actions/workflows
我的示例輸出如下所示:
{
"total_count": 1,
"workflows": [
{
"id": 161335,
"node_id": "MDg6V29ya2Zsb3cxNjEzMzU=",
"name": "CI",
"path": ".github/workflows/blank.yaml",
"state": "active",
"created_at": "2020-01-08T23:48:37.000-08:00",
"updated_at": "2020-01-08T23:50:21.000-08:00",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/161335",
"html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/161335",
"badge_url": "https://github.com/octo-org/octo-repo/workflows/CI/badge.svg"
}
]
}
如何從此輸出中獲取作業流 yaml 檔案
uj5u.com熱心網友回復:
給定檔案名,使用獲取存盤庫內容 API來獲取檔案。
對于您的檔案,那將是:
curl \
-H "Accept: application/vnd.github.v3 json" \
https://api.github.com/repos/octo-org/octo-repo/contents/.github/workflows/blank.yaml
回應 JSON 將包含一個欄位content,其中包含該作業流的編碼內容。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/452558.html
標籤:github github-动作 github-api
