github-actions - Github Actions:使用提交摘要确定 npm 版本
问题描述
我想知道,如何在 GitHub 操作中检测提交摘要(或描述)的前缀以确定要指定哪个 <update_type> 运行:
npm version <update_type>
我希望在我的提交描述中添加这样的内容:
[RELEASE/type:"patch"] Lorem ipsum dolor sit amet...
[RELEASE/type:"minor"] Lorem ipsum dolor sit amet...
[RELEASE/type:"major"] Lorem ipsum dolor sit amet...
我也在想我可能只想在没有发布的情况下提交(也许?):
Lorem ipsum dolor sit amet...
本质上,如果存在则提取 RELEASE/type,然后运行:
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [14]
steps:
- name: Update the published package version number
run: npm version ${{ EXTRACTED_RELEASE_TYPE }}
但是,我想知道如何从摘要/描述中提取 - 并将其吐出到 env 变量中以增加......
也可能有一个警告,我希望对 repo 的这种更改也被提交?这可能吗?看起来更像是提交后的操作,如果我提交会导致无限循环的麻烦?
如果这是可能的,我认为动作中的 if 语句需要类似于:
if: true === startsWith(github.event.head_commit.message, [RELEASE/type:"minor"])
run: npm version minor
然后确保以某种方式提交对 package.json 的更改?
任何有关如何实现这一目标的专业提示将不胜感激。
解决方案
推荐阅读
- java - Android 如何在用户硬重置设备时保护应用程序不被删除
- xml - 使用“管道”字符的 XPath“或”运算符?
- discord.py - 如何用 praw 提取 reddit 提交内容?
- mysql - 在 Google Apps 中查询 MySql 多个语句
- html - Brython:导入bs4库和requests库
- javascript - 如何使用 Javascript/Jquery 更改或关闭 css 属性?
- node.js - 节点 pg pool.query 没有调用我的回调
- pandas - 对过滤后的 DataFrame 或 Series 进行切片(使用负索引切片观察到的结果)
- javascript - 如何根据 curl 请求在 Node 中发出 http post 请求?
- mysql - sql锁表多服务器一数据库