hugo-coder icon indicating copy to clipboard operation
hugo-coder copied to clipboard

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

Open JensRantil opened this issue 2 years ago • 3 comments

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:

  • It's not beginner-friendly. For example, see https://github.com/luizdepra/hugo-coder/issues/99.
  • It's error prone. It's easy to miss doing this.
  • It's One More Thing™️ to do when submitting a pull request.
  • It easily creates merge conflicts between pull requests. Two PRs currently that will yield merge conflicts are https://github.com/luizdepra/hugo-coder/pull/862 and https://github.com/luizdepra/hugo-coder/pull/863.

Proposed solution

  • Remove asking all developers to execute make release on every pull request.
  • Make Github Actions, execute this every time main is updated with a new commit.

JensRantil avatar Nov 26 '23 21:11 JensRantil

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

luizdepra avatar Nov 29 '23 13:11 luizdepra

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 avatar Jan 22 '24 02:01 simonhollingshead

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.

simonhollingshead avatar Jan 24 '24 04:01 simonhollingshead