如何在github操作中访问github标签消息

问题描述

我想在 Github Actions 中捕获 github 标签消息。

如果用户推送带有一些消息的标签,例如

git tag -a 1.0.0 -m "Test Message"

比,我想在 github 操作中捕获该消息(“测试消息”)。

非常感谢任何帮助或参考。

解决方法

如果您无法通过 github 操作运行 git 命令。验证结帐日志,你应该有这样的东西

git version 2.17.1 
Deleting the contents of <YOUR REPO> 
The repository will be downloaded using the GitHub REST API 
To create a local Git repository instead,add Git 2.18 or higher to the PATH
Downloading the archive Writing archive to disk Extracting the archive

根据您的要求安装最新版本的 git。我已使用 PPA 安装在 ubuntu 自托管运行器上。 一旦版本问题得到修复并且 github 操作是克隆 repo 而不是通过 rest api 下载。比使用下面的命令

git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git tag -l --format='%(contents:subject)' ${GITHUB_REF#refs/*/}