Member-only story
I Built A GitHub Action To Fight The Multitasking Habit
And how you can create yours too
To me, multitasking is like salt. The right amount can improve your meal but too much would make it not edible and unhealthy. That is why it is so hard to get right.
“Multi-tasking — the art of doing twice as much as you should half as well as you could.”
It is extremely tempting to abuse multitasking. Many Developers do. I don’t blame them. It gives the illusion that you are progressing fast as you are doing several tasks at once. This might have the opposite effect. Suddenly, you have more comments and pull requests to take care of. You can be monopolizing the work stack and making it progress slower.
It has been demonstrated that switching from one task to another takes some time. That is a toll on productivity. When resuming a previously pause task you may be changing the context entirely. By the time you are warmed up, you might need to address some comments on another pull request.
There are many ways and techniques in which we can fight this problem. However, I missed any sort of tooling on the GitHub CI space. That’s why I decided to create a GitHub action.
PR Limit Github Action
I had a pretty simple idea. If we could limit the amount of PRs that can be opened by any developer we would be discouraging heavy multitasking. I could not find any tools to do that on GitHub. The only thing you can do is filter PRs by author and monitor that passively.
We humans, are pretty bad at monitoring and doing repetitive tasks. I created a simple Github Action to do that for us. As two projects or teams are not alike I have added some configuration preferences.
How does it work? It checks if the author of the PRs has reached his limit of active
PRs. If so, it would automatically close the PR and leave a comment.
Params
- MAX_PRS — the maximum number of PRs allowed per GitHub Actor
- EXCLUDE — Any author that we might want to skip this check for. A clear example is Dependabot.
- GITHUB_TOKEN — the Github Token