首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如何使用workflow_run读取标记名

workflow_run是GitHub Actions中的一个事件类型,用于在工作流程运行时读取标记名。

要使用workflow_run读取标记名,可以通过以下步骤进行操作:

  1. 在GitHub仓库中创建一个工作流程文件(例如:.github/workflows/main.yml)。
  2. 在工作流程文件中定义一个workflow_run事件,用于触发特定的工作流程运行。例如:
代码语言:txt
复制
on:
  workflow_run:
    types:
      - requested

这样配置的workflow_run事件将在每次触发请求时被触发。

  1. 在工作流程文件中,使用${{ github.event.workflow_run }}来访问workflow_run事件的上下文数据。 例如,要读取标记名,可以使用${{ github.event.workflow_run.inputs.ref }}

完整的工作流程文件示例:

代码语言:txt
复制
name: Workflow Run Example

on:
  workflow_run:
    types:
      - requested

jobs:
  example_job:
    runs-on: ubuntu-latest
    steps:
      - name: Read Tag Name
        run: echo "Tag Name: ${{ github.event.workflow_run.inputs.ref }}"

这个示例中,当有新的workflow_run请求时,工作流程文件将被触发运行。在example_job中,使用echo命令将${{ github.event.workflow_run.inputs.ref }}输出到日志中,即打印标记名。

对于腾讯云的相关产品和产品介绍链接地址,可以根据具体的需求和场景选择适合的产品,例如:

  • 云函数(Serverless):https://cloud.tencent.com/product/scf
  • 云原生应用服务(TKE):https://cloud.tencent.com/product/tke
  • 云数据库 MySQL:https://cloud.tencent.com/product/cdb_mysql
  • 云存储 COS:https://cloud.tencent.com/product/cos
  • 腾讯云区块链服务:https://cloud.tencent.com/product/tbaas
  • 腾讯云物联网套件:https://cloud.tencent.com/product/iot-suite
  • 腾讯云移动开发:https://cloud.tencent.com/product/tcb
  • 腾讯云安全产品:https://cloud.tencent.com/product/saf
  • 腾讯云音视频处理:https://cloud.tencent.com/product/mp
  • 腾讯云元宇宙相关产品:https://cloud.tencent.com/product/metauniverse

以上只是腾讯云部分产品的链接,更多详细的产品信息和介绍可以访问腾讯云官方网站进行查阅。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

领券