GitHub Action or GitHub App/Bot to Lint PRs
See original GitHub issueDoes the DotNet team have any plans of making this a GitHub Action or GitHub Bot?
As it would be good to have this available to lint PRs automatically for us with GitHub Checks API and highlight the items in the GitHub diff view of a PR with using the dry-run
option
Where finally you could use the Checks API to Automatically fix the errors & do a commit on a users behalf if they choose that they want to correct it.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:11
Top Results From Across the Web
Marketplace Actions Lint Action
Lint Action. Shows linting errors on GitHub commits and PRs; Allows auto-fixing issues; Supports many linters and formatters. Note: The behavior of actions ......
Read more >PR Lint Action - GitHub Marketplace
A GitHub Action that verifies your pull request contains a reference to a ticket. You can use this to (optionally) check: The PR...
Read more >Lint Action - GitHub Marketplace
Lint Action. Shows linting errors on GitHub commits and PRs; Allows auto-fixing issues; Supports many linters and formatters. Note: The behavior of actions ......
Read more >Marketplace Actions Lint Pull Request
Lint the pull request structure and leave a comment suggesting changes if linting fails.
Read more >Marketplace Actions Pull Request Linter
Pull Request Linter code style: prettier. :octocat: A fast TypeScript GitHub Action to ensure that your PR title matches a given regex.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just published my action to the marketplace https://github.com/marketplace/actions/dotnet-format. This can be used to run
dotnet-format
during your builds to report formatting errors, or to apply fixes and push them back to your branch.The workflow to trigger via a slash command is a little verbose at the moment. I have a couple changes in the works that will hopefully clean that up some. If/when actions support early job termination without creating an error this will be a lot cleaner.
If you run into any issues or have suggestions open an issue and let me know. Hope this is useful for some of you.
I’ve been working on a couple actions for doing this. If you’re already running
dotnet-format
in a workflow and want annotations you can get them by adding my dotnet-format-problem-matcher before you rundotnet-format
:The report messages aren’t as useful as those from other tools such as ESLint but it’s a good start. There’s a discussion in #525 about this.
I also have dotnet-tool-restore which will install any .net local tools setup in
.config/dotnet-tools.json
. I’ve been running this right afteractions/setup-dotnet
.I also have dotnet-format to run the tool but it’s not published yet, should be available later today or tomorrow. One of the nice features of this action is the option to format just the files that have changed so you can limit the scope of your PRs.
With these actions and a couple others I’m running
dotnet-format
on PRs with--dry-run
to report any formatting violations with annotations. Then I have a second workflow that runs on PR comments looking for/dotnet format
and will apply the fixes and push them back to the PR branch. I’m having trouble with this setup though because code pushes fromGITHUB_TOKEN
don’t trigger workflow runs, so a followup build & format check doesn’t occur. This was said to be possible using a Personal Access Token instead but that’s also not working for me right now 😕