Linting fails with `found character '\t'` when no `\t` are present in the file
tchupp opened this issue · 6 comments
I'm working on a GitHub bot that helps keep specific files in git repos up to date with an upstream. As part of my automated tests I have a yaml file that contains the current date:
$ cat test-source-1/source.yml
current_time: 'Thu Aug 12 21:18:39 UTC 2021'
When I run yamllint
locally, I get exit code 0:
$ yamllint . -f colored
$ echo $?
0
But when GitHub Actions run the yaml lint, it gets a weird error...
https://github.com/sporkfed/test-destination-1/runs/3324387902
github-actions $
Run ibiqlik/action-yamllint@v3
with:
format: parsable
strict: false
no_warnings: false
======================
= Linting YAML files =
======================
Error: logs/refs/remotes/origin/sporkfed/test-source-1/source.yml:1:178: [error] syntax error: found character '\t' that cannot start any token (syntax)
Error: Process completed with exit code 1.
syntax
doesn't seem to be a rule I can disable either
You can find all the code to reproduce here: https://github.com/sporkfed/test-destination-1
That is really weird, like if there was a hidden character in the file and to make it even weirder I forked that repo just to be able to reproduce the problem and there are no errors https://github.com/ibiqlik/test-destination-1/actions/runs/1131066739
Out of curiosity, can you add a step run: cat -A test-source-1/source.yml
, where -A
prints every "hidden" character.
I would also not be surprised if a rerun would magically make the issue disappear Saw many runs showing the same errors.
On this run the paths to source.yml
and yaml-lint.yml
are different
Error: logs/refs/remotes/origin/sporkfed/test-source-1/source.yml:1:179: [error] syntax error: found character '\t' that cannot start any token (syntax)
Warning: /workflows/yaml-lint.yml:2:1: [warning] truthy value should be one of [false, true] (truthy)
Error: Process completed with exit code 1.
That’s so weird! I didn’t notice that at all.
It seems like yamllint is finding more than just the expected files! Let me try a few more things real quick..
Upon subsequent runs of the same commit, it now passes! I’m going to chalk this up to GitHub Actions being weird 😂
failure: https://github.com/sporkfed/test-destination-1/runs/3324387902
Success: https://github.com/sporkfed/test-destination-1/actions/runs/1128496040
Oh man, it's back!!
https://github.com/sporkfed/test-destination-1/pull/9/checks?check_run_id=3343184236
It seems to only happen on GitHub actions for PRs? sporkfed/test-destination-1#9
Ahh I found where that weird file is coming from! It looks like yamllint
is scanning the .git
directory: https://github.com/sporkfed/test-destination-1/runs/3343301298
This doesn't seem to cause an issue locally, but it does cause an issue in GitHub Actions!