Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cschleiden/actionlint-interpreter
Interpreter for GitHub Actions Expressions
https://github.com/cschleiden/actionlint-interpreter
actions github go
Last synced: 29 days ago
JSON representation
Interpreter for GitHub Actions Expressions
- Host: GitHub
- URL: https://github.com/cschleiden/actionlint-interpreter
- Owner: cschleiden
- License: mit
- Created: 2022-03-14T03:29:07.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-04T22:32:48.000Z (almost 3 years ago)
- Last Synced: 2024-10-26T11:51:13.332Z (3 months ago)
- Topics: actions, github, go
- Language: Go
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# actionlint-interpreter
Simple expression interpreter for _GitHub Actions Expressions_ operating on the AST produced by https://github.com/rhysd/actionlint.
## Usage
```golang
expression := "input.foo <= input.bar"// Lex & Parse
lexer := actionlint.NewExprLexer(expression + "}}")
parser := actionlint.NewExprParser()
n, perr := parser.Parse(lexer)
if perr != nil {
panic(perr)
}// Evaluate expressions
result, err := Evaluate(n, ContextData{
"input": ContextData{
"foo": float64(1),
"bar": float64(2),
},
})
if err != nil {
panic(err)
}fmt.Println(result.Value)
// Output: true
```### TODO
Not everything is implemented yet:
#### Context access
- [x] Finish object & array access
- [ ] Wildcard access (`inputs.*.foo`)#### Functions
- [ ] contains
- [x] startsWith
- [x] endsWith
- [ ] format
- [x] join
- [ ] toJSON
- [x] fromJSON
- [ ] hashFilesStatus check functions:
- [ ] success
- [ ] always
- [ ] cancelled
- [ ] failure