如何通过GitHub Actions来触发AzureDevOps Pipeline

由于无法控制的原因,您可能在ADO (AzureDevOps)中有一个构建或发布管道,您想从GitHub触发。事实证明,Azure已经发布了一个操作来做到这一点!你可以在这里找到它:@Azure/pipelines

如何使用 @Azure/pipelines action

首先,您需要创建一个个人访问令牌(PAT),该令牌具有触发ADO管道的权限。您可以通过访问azure开发组织主页来完成此操作。打开用户设置>选择个人访问令牌>点击生成新令牌>选择所需的权限>单击Create。您需要授予令牌Release: Read, write, & execute和/或Build: Read & execute权限(取决于您的管道是触发Build还是Release)。有关pat以及如何创建pat的详细说明,请参阅官方文档:创建个人访问令牌

一旦你有了你的PAT,你需要把它添加到你的GitHub存储库的秘密。要做到这一点,请到您的GitHub存储库>设置在秘密的在行动比;添加一个新秘密。然后输入:

  • Name: ADO_PAT
  • Secret: <paste your PAT here>

然后在你的GitHub工作流文件中,你可以使用这样的动作:

```

复制代码
- name: Trigger ADO pipeline
  uses: Azure/pipelines@v1.2
  with:
    azure-devops-project-url: 'https://dev.azure.com/<org>/<project>' # Replace with your ADO project URL
    azure-pipeline-name: '<your ado pipeline name>' # Replace with your pipeline name
    azure-devops-token: '${{ secrets.ADO_PAT }}' # This is the PAT secret you created above
    azure-pipeline-variables: '{"accessLevel": "public", "<optional-pipeline-variable>": "<variable-value>"}' # These are optional

```

相关推荐
胡萝卜术1 小时前
从聊天模型到本地执行助手:Remote MCP 多工具 Agent 实战
面试·架构·github
慕容引刀4 小时前
告别Commit信息纠结:使用Git AI Commit插件实现规范化提交
人工智能·git·github·visual studio code·visual studio
GoGeekBaird13 小时前
我开源了 BeeWeave,给 AI Agent 搭一个越用越懂你的知识创作台
后端·github
fthux14 小时前
GitZip Pro 源码解析:一个 GitHub 文件/文件夹下载扩展是如何工作的(一)整体架构与扩展入口
人工智能·ai·开源·github·open source
第一程序员15 小时前
Rust Agent 子进程执行:Command 之前,先定义输入和超时
python·rust·github
2501_9369603616 小时前
GitHub初步了解
github
wangruofeng18 小时前
11 万 Star 的生成式 AI 入门课,Microsoft 做对了什么
github·aigc·ai编程
IOT那些事儿18 小时前
GitHub Profile 429: Too Many Requests
github·profile·429
峰向AI18 小时前
Agent 看不了视频?这个 7K Star 的开源插件一招搞定
github
程序员吕洞宾18 小时前
开源多维表格SmartTable V1.6:自动化工作流,把重复操作交给系统即可
开源·自动化·github·多维表格·飞书多维表