DEV Community

Play Button Pause Button

Monetizing Code Test Coverage - PayID BlockSprint Hackathon Submission

hammertoe profile image Matt Hamilton ・1 min read

One of the hardest things in Open Source software is encouraging testing and documentation.

So I've developed a Github action that can be used to analyse the coverage of tests on a codebase and then make a payment to the pull-requester when their pull request is merged into the main branch.

When you open a pull request it looks at the persons bio on Github and scans it for any PayIDs:

Put your PayID in your Github bio

It then creates a comment in the PR showing how much will be paid out to that person. The admin can amend or edit that comment and when the PR is closed the payment is automatically paid to that PayID via XRP / Xpring.

A comment is added letting you know what will be paid

When the branch is merged then the action will scan the PR comments to find the comment about payment and make the actual payments:

Payment complete

And within seconds the payment will appear in their XRP wallet:

Payment in wallet

By using PayIDs this approach can be extended to work with any cryptocurrency or payment mechanism.

You can get the code, and have a look at an example workflow for using it in the Github repo:



A Github Action that pays a contributor in XRP for pull requests that increase the test code coverage of a repo

The idea is to incentivise testing and improve code quality

The address to send the payment to is looked up via PayIds from the PR opener's bio on Github.

When a PR is opened then the action checks the openers profile bio and looks for a PayID:

Image of PayID in Github Bio

The action then puts a comment in the PR having resolved the PayID to an XRP address and calculated how much XRP to pay them based on increase in code test coverage:

Image of comment in PR indicating payment upcoming

The owner of the repo can edit the comment if they like to adjust the amount or remove/add additional payees.

Once the PR is closed then the action makes the actual payments and comments on the PR with the XRP Ledger txn id:

Image of comment in PR showing completed payment

Within seconds the payment arrives…


Editor guide