GithubHelp home page GithubHelp logo

Comments (5)

rhysd avatar rhysd commented on June 3, 2024 1

I commented to the original issue.

actions/runner#418 (comment)

from actionlint.

rhysd avatar rhysd commented on June 3, 2024 1

Thank you for the clarification. Then I'm closing this issue.

from actionlint.

rhysd avatar rhysd commented on June 3, 2024

I didn't know this behavior. It looks nice if actionlint can catch it. I need to check how go-yaml parses the syntax. Can you provide some sample YAML input which should cause the error? I could find an example in the issue description.

from actionlint.

rhysd avatar rhysd commented on June 3, 2024

I tried this on my test repository but it looks that >- is supported.

Workflow was:

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: >-
          echo foo
          bar

And echo foo bar seemed to be executed correctly.

image

Am I misunderstanding anything?

from actionlint.

sarayourfriend avatar sarayourfriend commented on June 3, 2024

Interesting! I had a PR that would use this in a workflow on WordPress/openverse, and another maintainer had run into an issue before with >, and advised me to avoid it, including the link to the GitHub actions issue I shared in this issue's description.

I'm realising now that I didn't actually get a chance to try the workflow I was modifying (it only runs when we publish a release, so not in a PR), and I did not look deeply into the issue the other maintainer had. It seems like the other issue may have been unrelated to the > usage (it wasn't even >-).

Anyway, I'm playing around now with the original failure that the other maintainer ran into, and it turns out it has to do with the leading whitespace on the other lines of the block, which you've left out.

I think GitHub's YAML parser works perfectly, the Openverse project and the person who opened actions/runner#418, just didn't understand (or expect) how YAML parses leading whitespace on lines inside a > block.

Compare these two: without leading whitespace on the second line and with leading whitespace. I, and I bet everyone else having this issue, incorrectly assumed the whitespace would be treated just as spaces. However, the YAML spec (somewhat inexplicably, if you ask me, but 🤷), thinks there should be a newline in those cases.

Here's the relevant section in the YAML spec: https://yaml.org/spec/1.2.2/#block-folding

folding does not apply to line breaks surrounding text lines that contain leading white space

Meaning, newlines are inserted when there is leading whitespace.

So, while I wish this was something actionlint could solve, I don't think it's within actionlint's scope. It's really better put to a YAML linter to warn you that this feature might have some pitfalls. I'm not confident either way, but I think you'd be fine to close this issue as out of scope.

Thanks for taking the time to look at this!

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.