errata-ai / vale-action

:octocat: The official GitHub Action for Vale -- install, manage, and run Vale with ease.
MIT License
201 stars 51 forks source link

Error: panic: runtime error: index out of range [-1] #76

Closed jouni closed 2 years ago

jouni commented 2 years ago

We’ve been getting this error in multiple pull requests recently, and I’m not sure why.

https://github.com/vaadin/docs/actions/runs/3156575828/jobs/5136429971/#step:4:1

Screenshot 2022-09-30 at 9 01 18
jdkato commented 2 years ago

This looks like a bug with Vale (not the action itself). Does it also occur locally?

jdkato commented 2 years ago

I tried briefly and I couldn't reproduce this using your local configuration. So, it's probably something that was fixed in a more recent version of Vale.

You may want to consider updating to the Reviewdog-based action, which supports the latest version of Vale.

jouni commented 2 years ago

Thanks for looking into it! No problems running locally.

I'll try updating to the new action.

jouni commented 2 years ago

The reviewdog-based action works nicely. Though, I’m having trouble using the --config option, fails with “path does not exists”.

This works locally:

vale --config='.vale-pr.ini' .

But this fails with the GitHub action:

vale_flags: "--config='.vale-pr.ini'"

Update: I tried the following variations:

--config='${GITHUB_WORKSPACE}/.vale-pr.ini'
--config='$GITHUB_WORKSPACE/.vale-pr.ini'
--config='${{env.GITHUB_WORKSPACE}}/.vale-pr.ini'
--config='${{github.workspace}}/.vale-pr.ini'

No luck. I’m not very familiar with the correct syntax I should use here.

The last one seems like it should work, as it produces this command (though I wonder about the duplicate docs there), but it still fails the same:

/github/home/vale --config='/home/runner/work/docs/docs/.vale-pr.ini'
jdkato commented 2 years ago

Does it work if you remove the extra quotes?

vale_flags: "--config=.vale-pr.ini"
jouni commented 2 years ago

Yes, looks like that works. Thanks! I should have realized to try that as well.