The maintainer's CI workflows recipe for a peaceful open source life
Liran Tal
Posted on November 30, 2021
My Workflow
My GitHub Actions hackathon application entry is about all the small things that would contribute to a better maintainer life.
Maintainers usually get a good grip on the important things, like making sure they have a workflow that run code style checkers, tests, and that publishes a package to the registry.
Busy with these, they end up forgetting about the small things that are the details, but as important, for example: having a markdown linter in place to ensure no broken documentation.
Can we reach open source maintainer nirvana?
I can't promise you that, but I can promise I will do everything I can to put us on that direction.
With that in mind, I'm suggesting a recipe of several GitHub Actions CI workflows that you can add to your open source repositories at GitHub. I've segmented them into specific areas too.
Markdown documentation
This recipe will introduce the following workflows:
Markdown Style linter - Making sure your documentation like the README.md has proper
Markdown Links linter - Making sure your documentation has no broken links
Dependency management
New dependencies advisor - Add a comment in a Pull Request informing of newly added dependencies and their package health
Pull Request engagement
Pull Request title update - Do you manage multiple base branches with PRs to? If you manually updated your PR titles to include this information then now this is automated for you
Pull Request contribution fun note - Welcome contributors to your project by adding a comment that thanks them and embeds an image of a cute animal
Submission Category:
Maintainer Must-Haves
Repository
The following repository demonstrates the workflow this application suggests:
Repository for GitHub Actions Hackathon on Dev.to 2021 [actionshackathon21]
GitHub Actions Hackathon 2021
This repository demonstrates the workflows recipe for the GitHub Actions Hackathon with Dev.to 2021
title: The maintainer's CI workflows recipe for a peaceful open source life
published: true
description: My submission to the GitHub Actions x DEV Hackathon 2021
tags: actionshackathon21, github, opensource
My Workflow
My GitHub Actions hackathon application entry is about all the small things that would contribute to a better maintainer life.
Maintainers usually get a good grip on the important things, like making sure they have a workflow that run code style checkers, tests, and that publishes a package to the registry.
Busy with these, they end up forgetting about the small things that are the details, but as important, for example: having a markdown linter in place to ensure no broken documentation.
Can we reach open source maintainer nirvana
I can't promise you that, but I can promise I will do…
Let's put all of it together and see how they add to an overall better experience for both maintainers and contributors alike.
Pull Request title update
As you can see, a few minutes after creating the pull request, the action kicks in and updates the title so that it includes a base branch prefix (the text [main]).
To make that magic happen, we create a brand new GitHub Action workflow file and add this:
Ain't it cute to get that nice little note? I think so too ;-)
To make that magic happen, we create a brand new GitHub Action workflow file and add this:
New dependency advisor
I can't stress enough how important is making sure you are using healthy dependencies, and those without security vulnerabilities. How can you tell if a new one someone adds to your project is a liability or a gift?
Luckily, we have the Snyk Advisor, and this handy GitHub Action helping us vet it:
If a markdown file doesn't confirm to proper style conventions then we can find out about it in the Pull Request CI phase rather than after we see it "in production", or in other words, showing up to the whole world as the face of the repository:
To make that magic happen, we create a brand new GitHub Action workflow file and add this:
And make sure that you have the accompanying configuration file for it as such:
# Default state for all rulesdefault:true# MD033/no-inline-html - Inline HTMLMD033:# Allowed elementsallowed_elements:['p','br','h1','h2','h3','h4','a','img']# Don't fail on line length limit of 80 charsMD013:false# Don't fail on first line of the file not being a markdown heading (maintainers like beautiful READMEs)MD041:false
Markdown Links linter
Want to avoid broken links in your README? Me too
That's why I can now find out about it when it happens in the CI process when I push a change via a pull request rather than after the fact:
To make that magic happen, we create a brand new GitHub Action workflow file and add this: