Coder Social home page Coder Social logo

Comments (7)

steve-viso avatar steve-viso commented on August 22, 2024 6

Hey, I was wondering if there is any plans to implement this?

from actionlint.

krisrecur avatar krisrecur commented on August 22, 2024 4

+1. This would be very useful!

from actionlint.

ChrisCarini avatar ChrisCarini commented on August 22, 2024 2

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.

andyfeller avatar andyfeller commented on August 22, 2024 1

@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?

  1. 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)
    }
  2. 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.

karlbrown-va avatar karlbrown-va commented on August 22, 2024 1

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.

rhysd avatar rhysd commented on August 22, 2024

References:

from actionlint.

SimonHeimberg avatar SimonHeimberg commented on August 22, 2024

Some ideas:

  • distinguish between workflow and action:
    • workflow has top level keys jobs and on
    • action has top level key runs
  • 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) or docker
    • 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)
    • ???

from actionlint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.