GitHub Actions 配置格式的名称是什么?
What is the name of this GitHub Actions configuration format?
在 GitHub Action for Hugo 的描述中,我看到以下代码片段:
workflow "Hugo build" {
resolves = [
"Hugo Action",
]
on = "push"
}
action "Hugo Action" {
uses = "srt32/hugo-action@master"
needs = "Filters for GitHub Actions"
args = "--theme=hyde-x"
}
action "Filters for GitHub Actions" {
uses = "actions/bin/filter@b2bea0749eed6beb495a8fa194c071847af60ea1"
args = "branch master"
}
在我的项目中,我使用YAML进行配置,因此我需要将上面的代码翻译成YAML。为此,我需要知道这个 format/language 是什么。
上面配置的格式名称是什么?
更新 1: 根据 this language identifier, it could be a Nginx 配置语言。
更新 2: 在 this article by Jason Etcovitch 中,我发现代码部分与 GitHub 操作中的代码部分非常相似。
更新3:好像是HCL,或者Hashicorp Configuration Language.
您已经发现它是 HCL (Hashicop Configuration Language) 的一个子集。这是 2019 年 8 月之前的测试版期间用于构建操作的语言。
来自回程机,2019年8月之前的动作格式是这样的:
2019年8月,新的YAML格式发布:
2019 年 10 月,HCL 工作流 didn't work anymore
来自this old article HCL 工作流配置语言的介绍
The Actions workflow language
All main.workflow files are written in the Actions workflow language,
which is a subset of Hashicorp’s HCL. In fact, our parser builds on
top of the open source hashicorp/hcl parser.
All Actions workflow files are valid HCL, but not all HCL files are
valid workflows. The Actions workflow parser is stricter, allowing
only a specific set of keywords and prohibiting nested objects, among
other restrictions. The reason for that is a long-standing goal of
Actions: making the Actions editor and the text representation of
workflows equivalent and interchangeable. Any file you write in the
graphical editor can be expressed in a main.workflow file, of course,
but also: any main.workflow can be fully displayed and edited in the
graphical editor. There is one exception to this: the graphical editor
does not display comments. But it preserves them: changes you make in
the graphical editor do not disturb comments you have added to your
main.workflow file.
从 HCL 到 YAML 的迁移指南似乎在 help.github.com 上不再可用,但旧站点在 wayback 机器上可用 here。坏消息是官方的 migration repo 已经被移除,workflow-parser repo 和 hcl fork 也被完全移除
您可以检查 this 为 HugoGithub 构建一个 Action 工作流程
在 GitHub Action for Hugo 的描述中,我看到以下代码片段:
workflow "Hugo build" {
resolves = [
"Hugo Action",
]
on = "push"
}
action "Hugo Action" {
uses = "srt32/hugo-action@master"
needs = "Filters for GitHub Actions"
args = "--theme=hyde-x"
}
action "Filters for GitHub Actions" {
uses = "actions/bin/filter@b2bea0749eed6beb495a8fa194c071847af60ea1"
args = "branch master"
}
在我的项目中,我使用YAML进行配置,因此我需要将上面的代码翻译成YAML。为此,我需要知道这个 format/language 是什么。
上面配置的格式名称是什么?
更新 1: 根据 this language identifier, it could be a Nginx 配置语言。
更新 2: 在 this article by Jason Etcovitch 中,我发现代码部分与 GitHub 操作中的代码部分非常相似。
更新3:好像是HCL,或者Hashicorp Configuration Language.
您已经发现它是 HCL (Hashicop Configuration Language) 的一个子集。这是 2019 年 8 月之前的测试版期间用于构建操作的语言。
来自回程机,2019年8月之前的动作格式是这样的:
2019年8月,新的YAML格式发布:
2019 年 10 月,HCL 工作流 didn't work anymore
来自this old article HCL 工作流配置语言的介绍
The Actions workflow language
All main.workflow files are written in the Actions workflow language, which is a subset of Hashicorp’s HCL. In fact, our parser builds on top of the open source hashicorp/hcl parser.
All Actions workflow files are valid HCL, but not all HCL files are valid workflows. The Actions workflow parser is stricter, allowing only a specific set of keywords and prohibiting nested objects, among other restrictions. The reason for that is a long-standing goal of Actions: making the Actions editor and the text representation of workflows equivalent and interchangeable. Any file you write in the graphical editor can be expressed in a main.workflow file, of course, but also: any main.workflow can be fully displayed and edited in the graphical editor. There is one exception to this: the graphical editor does not display comments. But it preserves them: changes you make in the graphical editor do not disturb comments you have added to your main.workflow file.
从 HCL 到 YAML 的迁移指南似乎在 help.github.com 上不再可用,但旧站点在 wayback 机器上可用 here。坏消息是官方的 migration repo 已经被移除,workflow-parser repo 和 hcl fork 也被完全移除
您可以检查 this 为 HugoGithub 构建一个 Action 工作流程