dprint / check

GitHub action for running `dprint check`.
16 stars 3 forks source link

Use an action `cache` to improve performance #12

Open nuke-web3 opened 1 year ago

nuke-web3 commented 1 year ago

https://github.com/actions/cache#cache-action can be used to store the dprint cache in this check action, that radically lessens the load for the action.

As a minimal example: this setup is working nicely for me so far. I have yet to see if the intended behavior (clear cache on update to *dprint.json) is working, but that seems like the most logical thing to signal an update.

The question is, should this action itself allow for use of a cache, optionally? IMHO yes, but perhaps just the example of using the action should include a cache.

nuke-web3 commented 1 year ago

here is an example of the cache working as expected on update to .dprint.json : https://github.com/Polkadot-Blockchain-Academy/pba-book/actions/runs/6125618243/job/16627953315#step:4:9

Maybe a tiny win, but a win IMHO :grin:

dsherret commented 1 year ago

Yeah, caching can lead to a huge performance improvement (ex. https://david.deno.dev/posts/faster-prettier-with-dprint/)

I just did a release of dprint that fixes a caching issue (https://github.com/dprint/dprint/releases/tag/0.41.0) on GH actions. There is a PR here about updating the docs to indicate how to do caching https://github.com/dprint/dprint/pull/740 but building it directly into the action would probably be good. I'm not sure if it should be turned on by default though. I think probably, with a major release of the action.

nuke-web3 commented 1 month ago

:wave: checking in here @dsherret - is cahce now integrated or is a manual wrapping needed? (like lychee uses for example)