luizdepra / hugo-coder

A minimalist blog theme for hugo.
MIT License
2.75k stars 1.07k forks source link

Simplify pull request flow by not having to run `make release` #864

Open JensRantil opened 1 year ago

JensRantil commented 1 year ago

Problem

I just submitted my first PR(s) to this repository. The pull request template asked me to execute make release in my pull request. I'm seeing multiple problems with this:

Proposed solution

luizdepra commented 1 year ago

Hmm. Well, maybe we don't even need to commit the files that generate conflicts. So, we should test this hypothesis first.

simonhollingshead commented 10 months ago

maybe we don't even need to commit the files that generate conflicts

If you're talking about the files in /resources, then if you don't commit them, everyone has to compile the SCSS to use the theme and therefore everyone needs hugo-extended, whereas providing /resources means that people can use either hugo or hugo-extended. The BSD variants and Solaris don't support hugo-extended, but linux, windows and mac do.

If you didn't mind the fact that you'd end up having two successive commits every time you merge an SCSS change, it would be absolutely trivial to have a GitHub Action commit the replacement resources folder on any new commit on main (and also possibly on a daily/weekly schedule to (a) validate that there has been no concurrency issue previously and (b) to automatically rebuild with the latest version of hugo in case it generates a slightly different result).

simonhollingshead commented 10 months ago

Primarily as a proof of concept, I've written a github action for my fork for use on my 'patched' branch which, on a new commit or once per day 'corrects' the resources directory if any delta exists (or silently does nothing otherwise). I'm glad I've done so as it saves me merge conflicts for my own patches, I now no longer need to regenerate the resources as the action will do it for me.

https://github.com/simonhollingshead/hugo-coder/blob/patched/.github/workflows/regen-resources.yml

https://github.com/simonhollingshead/hugo-coder/actions/runs/7635526340/job/20801101769

https://github.com/simonhollingshead/hugo-coder/commit/9034a3e1313fa09f6348fff5e735ad866e48e3d2

The runner completes in around 20 seconds, where 10 of them are spent waiting for the runner to be started in the first place.

If you want a similar thing contributed back, let me know.