angular - GitHub Action - 错误未定义:在参考或输入中找不到标签
问题描述
我正在尝试创建一个 GitHub 操作,该操作将检测某个分支何时发生更改,然后构建一个版本。我遇到的问题是在我的 yml 文件中我使用了这一行:
ncipollo/release-action@v1。这需要一个可用的标签,否则它将失败。我已经创建并推送了一个标签,但是当我运行该操作时出现此错误
Error undefined: No tag found in ref or input!
这是我的 yml 文件:
# Creates a release whenever a new change gets pushed onto the dev branch
# https://github.com/ncipollo/release-action
name: Dev-Build
on:
push:
branches:
- dev
jobs:
build:
name: setup environment
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2.1.3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v1.4.4
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm i
npm run build:ci
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.TOKEN }}
解决方案
默认情况下,标签不会使用checkout 操作从远程拉取:
对于触发工作流的 ref/SHA,默认情况下只获取一个提交。设置
fetch-depth: 0
为获取所有分支和标签的所有历史记录。
请参阅文档如何获取所有标签和分支的所有历史记录:
steps: - uses: actions/checkout@v2 with: fetch-depth: 0
推荐阅读
- c++ - 访问类的嵌套私有类
- c# - “baseSiteUrl”在 SPSite 中应该是什么样子?
- sql - System.TypeInitializationException:"Webservice.Helper.SqlHelper",System.NullReferenceException
- macos - 如何从 Mac 卸载 Appium 桌面及其缓存文件?
- powershell - Web App 无法创建提示“请求超时”
- html - 如何使内部带有网格的div居中?
- json - 在AngularJS中循环遍历包含数组的对象
- java - 如何延迟这个for循环
- python - 如何使用 C 中的 PortAudio 或 Python 中的 PyAudio 播放立体声
- android - 如何在不使用 Intent.ACTION_GET_CONTENT 的情况下将文件从媒体存储保存到 Firebase 存储