mainbot github action
1.0.0
此 GitHub 操作可讓您自動將檔案從儲存庫上傳到 mainbot API 端點。
glob-pattern
必需用於在儲存庫中尋找檔案的 glob 模式。預設值: ./docs/**
。
namespace
必要mainbot API 端點的命名空間。
api-url
必需檔案將上傳到的 Mainbot API 端點。
client-id
可選OAuth 驗證的用戶端 ID(如果您的 API 需要)。
client-secret
可選OAuth 驗證的用戶端金鑰(如果您的 API 需要)。
token-endpoint
可選用於 OAuth 驗證的令牌端點(如果您的 API 需要)。
client_id
和client_secret
)。 將 GitHub Action 新增到您的儲存庫
在儲存庫的根目錄中建立.github/workflows
目錄(如果尚不存在),並為您的工作流程新增新的 YAML 檔案(例如upload-files.yml
)。
設定工作流程文件
使用所需步驟設定您的工作流程文件。下面是一個設定範例:
name : Upload Files to API
on :
workflow_dispatch : {} # Enable manual triggering
push :
branches :
- main # Set your branch here
paths :
- ' docs/** ' # Set your docs folder path here
jobs :
upload :
runs-on : ubuntu-latest
steps :
- name : Checkout repository
uses : actions/checkout@v2
- name : Upload Files
uses : savantly-net/mainbot-github-action@main
with :
glob-patterns : ' **/*.txt ' # Set your file pattern here
namespace : ' /admin '
api-url : ' https://mainbot.savantly.net ' # Set your Mainbot API endpoint here
client-id : ${{ secrets.CLIENT_ID }} # Set your client ID here
client-secret : ${{ secrets.CLIENT_SECRET }} # Set your client secret here
token-endpoint : ' https://mainbot.savantly.net/oauth/token ' # Set your token endpoint here
設定 GitHub 秘密
前往儲存庫的「設定」>「機密」並新增您的CLIENT_ID
和CLIENT_SECRET
。
安裝後,該操作將根據工作流程檔案中定義的觸發器自動執行(例如,每次推送到main
分支時)。該行動將:
如需支援、問題或功能請求,請在 GitHub 儲存庫上提交問題。