I Built A GitHub Action To Fight The Multitasking Habit | by Jose Granja | Apr, 2022

And how one can create yours too

Caption primarily based on design of pch.vector

To me, multitasking is like salt. The correct quantity can enhance your meal however an excessive amount of would make it not edible and unhealthy. That’s the reason it’s so onerous to get proper.

“Multi-tasking — the artwork of doing twice as a lot as you need to half in addition to you would.”

This can be very tempting to abuse multitasking. Many Builders do. I don’t blame them. It provides the phantasm that you’re progressing quick as you might be doing a number of duties without delay. This might need the alternative impact. Abruptly, you have got extra feedback and pull requests to deal with. You might be monopolizing the work stack and making it progress slower.

It has been demonstrated that switching from one process to a different takes a while. That may be a toll on productiveness. When resuming a beforehand pause process you might be altering the context fully. By the point you might be warmed up, you may want to handle some feedback on one other pull request.

There are various methods and strategies through which we will battle this drawback. Nonetheless, I missed any kind of tooling on the GitHub CI house. That’s why I made a decision to create a GitHub motion.

I had a reasonably easy thought. If we might restrict the quantity of PRs that may be opened by any developer we’d be discouraging heavy multitasking. I couldn’t discover any instruments to do this on GitHub. The one factor you are able to do is filter PRs by writer and monitor that passively.

We people, are fairly unhealthy at monitoring and doing repetitive duties. I created a easy Github Motion to do this for us. As two initiatives or groups usually are not alike I’ve added some configuration preferences.

How does it work? It checks if the writer of the PRs has reached his restrict of lively PRs. In that case, it might routinely shut the PR and depart a remark.


  • MAX_PRS — the utmost variety of PRs allowed per GitHub Actor
  • EXCLUDE — Any writer that we’d need to skip this test for. A transparent instance is Dependabot.
  • GITHUB_TOKEN — the Github Token

The motion is listed within the GitHub’s Market

This motion continues to be in its early phases. There are various options which may be coming in future releases.

  • DISABLE_COMMENTS — an choice to opt-out of the touch upon PR habits.
  • INCLUDE_DRAFT — an choice to rely draft PRs inside the restrict of MAX_PRS.
  • MESSAGE — customized message to be displayed when the person reached his max variety of PRs.

When you’ve got some other concepts or future you have an interest within the constructing please depart a touch upon the repository here. I’m additionally open to any contribution to enhance the appliance.

Constructing a GitHub motion is fairly easy. To get began you solely must have a GitHub motion.

What are the steps it’s worthwhile to comply with:

  • select a singular app identify
  • create a public repo
  • an motion.yml that describes your GitHub motion
instance of a legitimate Motion.yml file
  • a JavaScript file to execute the motion
  • eat GitHub’s relaxation or graphql endpoints
  • the @actions/core and actions/github packages

When you meet all of these it is possible for you to to launch the appliance to the GitHub Market. You will notice a Public this Motion to GitHub Market test in your launch.

Caption of Releasing My Github Action
Caption of Releasing My Github Motion

Observe how there are some checks carried out on the motion.yml. That file serves because the descriptor of your motion. If there are any errors (possibly the motion identify is already taken) you may even see the errors at this stage.

You might use the ability of npm modules in your JavaScript file. Nonetheless, it’s worthwhile to bundle that collectively. For that, you might use Vercel’s ncc device.

It’s a less complicated bundle that helps JavaScript and TypeScript.

You possibly can set up it just by utilizing:

yarn add --dev @vercel/ncc

And create a dist script in your bundle.json:

"dist": "ncc construct src/index.ts -o dist"


How can we take a look at that our motion is working as anticipated? For that, we will run it regionally.

We are able to create a .github/workflows/take a look at.yml file in our repository. Then, you might invoke it as you’ll in your CI.

I hope you want my first GitHub Motion device and that you’re keen to make use of it as a part of your CI workflow. You might begin by setting a excessive MAX_NUMBER quantity and progressively adapt it to your staff’s wants.

I hope this will contribute to the well being of any staff well being and enhance its productiveness.

More Posts