在合并请求与特定标签时触发 GitHub 操作

Trigger GitHub action on merge of Pull Request with specific tag

我正在尝试使用 GitHub 操作在合并带有标签 Update 的合并请求时自动创建一个版本。

目前,我的工作流程在合并请求请求时触发,但我不确定如何让工作流程仅在合并请求具有 Update 标记时继续。

当前工作流程

name: Create Release

on:
  pull_request:
    types: [closed]

jobs:
  release:
    if: github.event.pull_request.merged == true

    ...rest of workflow...

您应该可以使用以下内容:

if: contains(github.event.pull_request.labels.*.name, 'Update')

由此https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#example-using-an-array