ibiqlik / action-yamllint

GitHub Action - Yaml Lint
MIT License
97 stars 41 forks source link

Output should be logged in a file #22

Closed dhimanmohit2548 closed 3 years ago

dhimanmohit2548 commented 3 years ago

It would be nice to have this feature to log all the output in a file which can be easily attached to an email using another Github action. Currently the output is only in the console and no ways to capture it and log into a file. https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputs

ibiqlik commented 3 years ago

@dhimanmohit2548 That's a great idea and easy to do. Should have something soon...

ibiqlik commented 3 years ago

@dhimanmohit2548 you want to give it a try https://github.com/ibiqlik/action-yamllint/pull/23?

You can test it like this: uses: ibiqlik/action-yamllint@log-output

dhimanmohit2548 commented 3 years ago

@ibiqlik Thank you for prompt reply, sure will give it a try tomorrow morning. Much Appreciated 😊

dhimanmohit2548 commented 3 years ago

@ibiqlik I tried using the branch but I am not able to see the contents of the file.

image

ibiqlik commented 3 years ago

@dhimanmohit2548 is Dump outputs step in the same job as Check for lint errors step or different? Because the file are not shared between steps unless you share them, see https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow

You can also see the run in that branch here https://github.com/ibiqlik/action-yamllint/runs/3293493615?check_suite_focus=true#step:6:1 and the workflow here https://github.com/ibiqlik/action-yamllint/blob/log-output/.github/workflows/lint.yml#L40

dhimanmohit2548 commented 3 years ago

@ibiqlik its the part of the same job. Its just next step after the perform lint step. Also can we have the

======================
= Linting YAML files =
======================

as part of the log file as well?

dhimanmohit2548 commented 3 years ago

@dhimanmohit2548 is Dump outputs step in the same job as Check for lint errors step or different? Because the file are not shared between steps unless you share them, see https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow

You can also see the run in that branch here https://github.com/ibiqlik/action-yamllint/runs/3293493615?check_suite_focus=true#step:6:1 and the workflow here https://github.com/ibiqlik/action-yamllint/blob/log-output/.github/workflows/lint.yml#L40

I was encoding the variable output into double quotes. My Bad. Its working fine, thanks

ibiqlik commented 3 years ago

@ibiqlik its the part of the same job. Its just next step after the perform lint step. Also can we have the

======================
= Linting YAML files =
======================

as part of the log file as well?

Capturing that is easy but as you can see in this run if you have multiple runs of yamllint it will capture for each one. Also if you wanted to do something with the log like parse it, having that print will only make it more difficult

atkaper commented 3 years ago

Hi @ibiqlik I would love to have the output file option also ;-) I want to show the lint result as PR comment, so having that data will give me that option. So implicit question; any estimates on when you can finish that? ;-)

ibiqlik commented 3 years ago

Oh shoot, on it...

ibiqlik commented 3 years ago

@atkaper do you want to try it out before I release?

uses: ibiqlik/action-yamllint@master just switch to @master

atkaper commented 3 years ago

Hi @ibiqlik ,

No, go ahead releasing it for the general public!

I'm afraid I was a bit impatient, and made my own (temporary?) version ;-) https://github.com/atkaper/yamllint-action

But thanks anyway for your speedy fix and update! Impressive! Maybe I'll give your version a try on another repository.

What my version now does, is run yamllint twice, once in github formatting mode, to annotate the changed code. And once to return the plain-text report to write as PR commit comment. Our developers tend not to look too good at the build status, and this way it's right in their face ;-) (in two spots)

Regards, Thijs.

ibiqlik commented 3 years ago

Available in v3.1.0