Issue
In the description of GitHub Action for Hugo I see the following code snippet:
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"
}
In my project, I am using YAML for configuration, therefore I need to translate the above code into YAML. To do this, I need to know what this format/language is.
What is the name of the format in which the configuration above is written?
Update 1: According to this language identifier, it could be a Nginx config language.
Update 2: In this article by Jason Etcovitch I found code parts that look very similar to those in the GitHub action.
Update 3: Seems to be HCL, or Hashicorp Configuration Language.
Solution
You have already found it was a subset of HCL (Hashicop Configuration Language). It was the language used for building actions during the beta before August 2019.
From the wayback machine, action format used to be like that before August 2019 :
In August 2019, the new YAML format was released:
In October 2019, HCL workflows didn't work anymore
From this old article a presentation of the HCL workflow configuration language
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.
It seems the migration guide from HCL to YAML is no longer available on help.github.com but the old site is available on the wayback machinehere. Bad news is that official migration repo has been removed,and the workflow-parser repo and hcl fork have also been removed completly
You can check this to build a Github Action workflow for Hugo
Answered By - Bertrand Martel Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.