如何通过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

```

相关推荐
薛定e的猫咪43 分钟前
Vibe Coding范式实战:用AI工具链(Stitch+Figma+ai studio+Trae)快速开发全栈APP
前端·人工智能·react.js·github·figma
Zzq_Fighting2 小时前
【Windows电脑使用PotPlayer挂载夸克网盘方法】
经验分享·github
九狼4 小时前
Riverpod 2.0 代码生成与依赖注入
flutter·设计模式·github
无限进步_8 小时前
面试题 02.04. 分割链表 - 题解与详细分析
c语言·开发语言·数据结构·git·链表·github·visual studio
CoderJia程序员甲15 小时前
GitHub 热榜项目 - 日榜(2026-02-22)
人工智能·ai·大模型·github·ai教程
CoderJia程序员甲16 小时前
GitHub 热榜项目 - 日榜(2026-02-21)
ai·大模型·llm·github·ai教程
九狼1 天前
Flutter Riverpod + MVI 状态管理实现的提示词优化器
前端·flutter·github
Zzz 小生2 天前
LangChain Streaming-Overview:流式处理使用完全指南
人工智能·python·语言模型·langchain·github
用户579854769712 天前
04:工具系统设计:从抽象基类到 JSON Schema 的完整实现
github
fchampion2 天前
最终一致性
java·spring·rabbitmq·github·mvc