Github Actions是否有模板 [英] Does Github Actions have templates
本文介绍了Github Actions是否有模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于我在Github Actions中重复了一些步骤,因此我想创建一个模板.让我们举个例子吧
As I have repetitve steps in my Github Actions, I would like to create a template. Let's make a example
name: ci
on: ["push"]
jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v1
- name: do stuff
run: |
bash stuff
是否可以仅将步骤保存在单独的文件中?然后导入?
Is it possible to save only the steps in a separated file? And import afterwards?
推荐答案
不幸的是,它看起来并不像github-actions支持重用工作流. 甚至不支持YAML定位符
Unfortunately it does not look like github-actions supports reusing workflows. Not even YAML anchors are supported.
It looks like the only way to share steps (not setup) is to create actions.
I have also caught wind of the possibility of reusing actions. Follow the issue to stay up-to-date.
这篇关于Github Actions是否有模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文