haskell-actions / run-fourmolu

Fourmolu GitHub Action
https://github.com/marketplace/actions/run-fourmolu
Other
9 stars 9 forks source link

leave little warnings or suggestions on PRs when the `fourmolu-action` fails #1

Open cdepillabout opened 2 years ago

cdepillabout commented 2 years ago

It would be nice if this Action left comments/warnings/suggestions on PRs on places in the code where the formatting doesn't match what fourmolu suggests.

I think https://github.com/tfausak/hlint-action does have this feature. It would be nice to have something similar here.

tchoutri commented 2 years ago

It is incredibly difficult today to determine where the fault lies in the codebase, since the Action doesn't say anything about which files are not formatted, neither in the files view, nor in the action interface

Screenshot_20220611_223009

wraithm commented 2 years ago

Absolutely agreed! Though, just letting you know, if you look at the run's logs, you'll see the suggestions.

On Sat, Jun 11, 2022, 13:31 Théophile Choutri @.***> wrote:

It is incredibly difficult today to determine where the fault lies in the codebase, since the Action doesn't say anything about which files are not formatted, neither in the files view, nor in the action interface

[image: Screenshot_20220611_223009] https://user-images.githubusercontent.com/15848443/173203911-5584c971-a407-4a6b-9f59-1de6803fc054.png

— Reply to this email directly, view it on GitHub https://github.com/fourmolu/fourmolu-action/issues/1#issuecomment-1152993174, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALRLUIUSW4WNQGVFHUVEVLVOTZQPANCNFSM5XMZ4BAQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tchoutri commented 2 years ago

@wraithm Hi, thank you for the quick response! Although I'm still perplex, because the logs as given by Github show me this:

Logs ``` 2022-06-11T20:33:25.9013329Z Requested labels: ubuntu-latest 2022-06-11T20:33:25.9013372Z Job defined at: flora-pm/flora-server/.github/workflows/linting.yml@refs/pull/123/merge 2022-06-11T20:33:25.9013397Z Waiting for a runner to pick up this job... 2022-06-11T20:33:26.7232470Z Job is waiting for a hosted runner to come online. 2022-06-11T20:33:29.7650923Z Job is about to start running on the hosted runner: GitHub Actions 4 (hosted) 2022-06-11T20:33:31.7667149Z Current runner version: '2.292.0' 2022-06-11T20:33:31.7697200Z ##[group]Operating System 2022-06-11T20:33:31.7697946Z Ubuntu 2022-06-11T20:33:31.7698297Z 20.04.4 2022-06-11T20:33:31.7698581Z LTS 2022-06-11T20:33:31.7699056Z ##[endgroup] 2022-06-11T20:33:31.7699465Z ##[group]Virtual Environment 2022-06-11T20:33:31.7699835Z Environment: ubuntu-20.04 2022-06-11T20:33:31.7700211Z Version: 20220605.1 2022-06-11T20:33:31.7700804Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20220605.1/images/linux/Ubuntu2004-Readme.md 2022-06-11T20:33:31.7701508Z Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20220605.1 2022-06-11T20:33:31.7702056Z ##[endgroup] 2022-06-11T20:33:31.7702458Z ##[group]Virtual Environment Provisioner 2022-06-11T20:33:31.7702823Z 1.0.0.0-main-20220531-1 2022-06-11T20:33:31.7703185Z ##[endgroup] 2022-06-11T20:33:31.7704293Z ##[group]GITHUB_TOKEN Permissions 2022-06-11T20:33:31.7704951Z Actions: write 2022-06-11T20:33:31.7705448Z Checks: write 2022-06-11T20:33:31.7705865Z Contents: write 2022-06-11T20:33:31.7706273Z Deployments: write 2022-06-11T20:33:31.7706592Z Discussions: write 2022-06-11T20:33:31.7706956Z Issues: write 2022-06-11T20:33:31.7707302Z Metadata: read 2022-06-11T20:33:31.7707602Z Packages: write 2022-06-11T20:33:31.7707980Z Pages: write 2022-06-11T20:33:31.7708348Z PullRequests: write 2022-06-11T20:33:31.7708693Z RepositoryProjects: write 2022-06-11T20:33:31.7709092Z SecurityEvents: write 2022-06-11T20:33:31.7709488Z Statuses: write 2022-06-11T20:33:31.7709788Z ##[endgroup] 2022-06-11T20:33:31.7713619Z Secret source: Actions 2022-06-11T20:33:31.7714163Z Prepare workflow directory 2022-06-11T20:33:31.8654385Z Prepare all required actions 2022-06-11T20:33:31.8862235Z Getting action download info 2022-06-11T20:33:32.0725594Z Download action repository 'fourmolu/fourmolu-action@v2' (SHA:e3d94cc70fa37f6014e374e239ae7709357bb5a0) 2022-06-11T20:33:32.7046314Z ##[group]Run fourmolu/fourmolu-action@v2 2022-06-11T20:33:32.7046713Z with: 2022-06-11T20:33:32.7047042Z pattern: src/**/*.hs test/**/*.hs app/**/*.hs 2022-06-11T20:33:32.7047412Z follow-symbolic-links: true 2022-06-11T20:33:32.7047719Z ##[endgroup] 2022-06-11T20:33:33.8822912Z ##[error]fourmolu detected unformatted files 2022-06-11T20:33:33.9265688Z Cleaning up orphan processes ```

This is the faulty run. Maybe I'm not looking at the right place?

wraithm commented 2 years ago

@tchoutri That's weird! We see the suggestions in our code base... You're definitely looking in the right place. I was mistaken and I'd actually expect it to show up in that place where you took that screen shot, (ie. https://github.com/flora-pm/flora-server/runs/6845560053?check_suite_focus=true).

Hmm...

cdepillabout commented 2 years ago

@tchoutri Thanks for reporting this. That does appear to be a bug, so I've opened up a separate issue to track this: https://github.com/fourmolu/fourmolu-action/issues/4

cdepillabout commented 1 year ago

I finally remembered where I saw use of warnings in PRs when an action fails:

https://github.com/cdepillabout/termonad/pull/226/files#diff-ad917605d3fe334f1476885d8cce49546dd9209ca03186e4a92679815177a65d

You can see that the GitHub actions leave a bunch of warnings, and those warnings are shown in the PR overview. It looks like this:

image

The warnings are the Check warning blocks that are inline in the code.

This might be a nice thing to figure out how to do for our fourmolu-action as well.