Comments (7)
Hey, I was wondering if there is any plans to implement this?
from actionlint.
+1. This would be very useful!
from actionlint.
I'm very interested in seeing this feature added. I started working on it, then realized that @msw-kialo already had a completely functional PR of it: #366
I pulled this PR locally, and merged in the ~250 updates from rhysd/actionlint (there were a handful of fairly easy merge conflicts to deal with), and was able to successfully test the PR locally.
I'd encourage others to also test the change and provide feedback in the PR.
from actionlint.
@rhysd : truly appreciate your good work here! ✨ 🙇
if someone was interested in contributing support for this feature, what would be some considerations for adding this that someone unfamiliar with the project might review?
-
Would
actionlint
be invoked with an arbitrary path containing composite action(s) and workflows, not simply.github/workflows/
?From /command.go, it seems this would need some minor rework as I'd would like to pass one or more directories on the command line to workflows and/or composite actions:
func (cmd *Command) runLinter(args []string, opts *LinterOptions, initConfig bool) ([]*Error, error) { l, err := NewLinter(cmd.Stdout, opts) if err != nil { return nil, err } if initConfig { return nil, l.GenerateDefaultConfig(".") } if len(args) == 0 { return l.LintRepository(".") } if len(args) == 1 && args[0] == "-" { b, err := io.ReadAll(cmd.Stdin) if err != nil { return nil, fmt.Errorf("could not read stdin: %w", err) } n := "<stdin>" if opts.StdinFileName != "" { n = opts.StdinFileName } return l.Lint(n, b, nil) } return l.LintFiles(args, nil) }
-
How difficult is it to account for a similar but different schema for composite actions versus a workflow file?
It seems parser.go is very specifically for workflow parsing. Some of this would be useful for parsing and validating composite files, however I don't know how you might want to restructure the detection of files to be parsed to use the right parser.
Thank you for discussing what this might entail as I genuinely want to see if we can help explain to someone who might be willing and capable of doing the work. 😹
from actionlint.
one thing that might help is this: https://check-jsonschema.readthedocs.io/en/stable/usage.html
pre-commit example:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 315c23f8562a5bafa15ab448ff542abe02d9e439 # frozen: 0.28.2
hooks:
- id: check-github-actions
Note however that this will not lint the inside of scripts, it will just confirm that your action.yaml schema is correct.
from actionlint.
References:
- Changelog: https://github.blog/changelog/2021-08-25-github-actions-reduce-duplication-with-action-composition/
- Document: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
from actionlint.
Some ideas:
- distinguish between workflow and action:
- workflow has top level keys
jobs
andon
- action has top level key
runs
- workflow has top level keys
- find action files:
- maybe those referenced in the workflow files
- maybe
**/action.yaml
(to find public actions) - maybe
.github/action*/*.yaml
- what to check:
- runs.using is
composite
or a node version (nodeXX) ordocker
- runs.steps of composite actions like steps of a job (p.parseSteps()) (but shell is required if run is set)
- ??? for docker actions
- ??? for JavaScript actions
- inputs (probably similar to inputs in "on")
- outputs (for composite actions probably like output of jobs)
- description exists (is mandatory)
- ???
- runs.using is
from actionlint.
Related Issues (20)
- Failed on "google-github-actions/get-secretmanager-secrets" HOT 7
- v1.6.27 Actionlint do not recognising outputs from google-github-actions/get-secretmanager-secrets@v2 HOT 1
- Seems like actionlint lack support to detect when we call reusable workflow in the main workflow. HOT 4
- Default shell not being detected - currently treats all `run` on Linux as shell HOT 2
- actionlint returns fatal error on `run:` script with broken Python code
- runner property "environment" is not defined in object type HOT 3
- Support Excluding through expression HOT 1
- `dorny/paths-filter@v3` added a new option HOT 3
- Detect malformed github variable declarations
- Missing Scope in GITHUB_ACTIONS Checks HOT 3
- False positive: `attestations` permission HOT 1
- Add support for Ubuntu 24 runners HOT 1
- Check duplicated step ID HOT 1
- Probable false positive when linting action.yml on the image directive HOT 3
- Feature request: Check that globs in `on.*.paths` match at least one file
- Missing results depending if actionlint is passed a filename vs piped in via stdin HOT 2
- Report redundant branch checks in GitHub Workflow jobs
- Detect actions that are pinned to master/main
- feature request: option to use ruff instead of pyflakes
- Call out ternaries with falsy value-if-true HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actionlint.