GitHub Actions Trigger

GitHub Actions Trigger

🚀 GitHub 动作指南

本指南详细介绍了如何使用相关工具与 GitHub Actions 进行交互,帮助您更好地自动化开发流程。

🚀 快速开始

🔍 获取 GitHub Action 信息

使用 get_github_action 工具获取特定 GitHub Action 的详细信息。

请求格式

{
"owner": "actions",
"repo": "checkout",
"ref": "v4"
}

响应示例

{
"name": "Checkout",
"description": "Check out a Git repository at a particular version",
"author": "GitHub",
"inputs": [
{
"name": "repository",
"description": "Repository name with owner. For example, actions/checkout",
"default": "",
"required": false
},
{
"name": "ref",
"description": "The branch, tag or SHA to checkout.",
"default": "",
"required": false
}
],
"runs": {
"using": "node20",
"main": "dist/index.js"
}
}

🚀 触发 GitHub 工作流

使用 trigger_github_action 工具触发特定的 GitHub 工作流。

请求格式

{
"owner": "username-or-org",
"repo": "repository-name",
"workflow_id": "ci.yml",
"inputs": {
"deploy_environment": "production",
"debug_enabled": "true"
}
}

响应示例

{
"success": true,
"message": "Workflow dispatch event triggered successfully",
"run": {
"id": 12345678,
"url": "https://github.com/owner/repo/actions/runs/12345678",
"status": "queued",
"conclusion": null,
"created_at": "2025-03-19T06:45:12Z",
"triggered_by": "API"
}
}

注意事项

⚠️ 重要提示

  1. 工作流必须配置为支持 workflow_dispatch 事件。
  2. GitHub 令牌必须具有 workflow 范围权限。
  3. 输入参数必须与工作流定义的参数匹配。

🔎 获取仓库中的 GitHub Actions

使用 get_github_actions 工具列出特定仓库中的所有可用 GitHub Actions。

请求格式

{
"owner": "actions",
"repo": "checkout"
}

响应示例

{
"count": 1,
"actions": [
{
"name": "Checkout",
"description": "Check out a Git repository at a particular version",
"author": "GitHub",
"inputs": [
{
"name": "repository",
"description": "Repository name with owner. For example, actions/checkout",
"default": "",
"required": false
},
{
"name": "ref",
"description": "The branch, tag or SHA to checkout.",
"default": "",
"required": false
}
],
"runs": {
"using": "node20",
"main": "dist/index.js"
}
}
]
}

📦 获取最新的两个发行版

使用 get_github_release 工具获取仓库的最新两个发行版本。

请求格式

{
"owner": "actions/runner",
"repo": "runners"
}

响应示例

[
{
"tag_name": "2.286.0",
"name": "GitHub Hosted Runner for Windows release 2.286.0",
"body": "New release of GitHub Hosted Runner for Windows.",
"published_at": "2024-03-19T15:00:00Z"
},
{
"tag_name": "2.285.0",
"name": "GitHub Hosted Runner for Windows release 2.285.0",
"body": "New release of GitHub Hosted Runner for Windows.",
"published_at": "2024-03-18T15:00:00Z"
}
]

注意事项

⚠️ 重要提示

  • 默认情况下,该工具会返回最新的两个发行版本。
  • 如果需要更多或更少的发行版本,请调整请求参数。

通过这些工具和示例,您可以更好地理解和使用 GitHub Actions 来自动化您的开发流程。

  • 0 关注
  • 0 收藏,11 浏览
  • system 提出于 2025-09-27 11:54

相似服务问题