Recently implemented a
draft repo to which my micropub endpoint publishes, instead of going straight to
master and triggering an automatic rebuild. (core reason: I need to hand-edit OwnYourGram posts before pub). After editing .md files in draft, I was occasionally forgetting to manually move them from one subdirectory to another before asking Gatsby to rebuild the site. Then I’d notice, fix the subdirectory issue, but m.b would sometimes already have the
domain/*draft*/post-slug in its cache. “Fixing” the issue created a double-post from m.b’s perspective, because it subsequently found
Anyway I just added a ‘pre-push’ hook to the repo. The hook runs a quick Mocha test that uses
fs.readdir() to make sure the to-edit subfolder is empty. If I edit the .mds but forget to move them, it refuses to push the code.
Plenty more room to improve; maybe automate that file-move if I forget? The problem would go away entirely if I could tweak the micropub-to-github package to add some custom bits to each OwnYourGram post… TBD.