DEV Community

Cover image for GitHub Action for Generating a World Map of Repository Contributions
Simon
Simon

Posted on • Edited on

GitHub Action for Generating a World Map of Repository Contributions

I found the inspiration to create this workflow after seeing some GitHub repositories listing contributors at the end of README. I thought that having a visual representation that shows where the contributors live would be a nice addition to those lists.

My Workflow

Below is a minimal example of how to use the workflow to get an SVG map generated and placed inside your repository once a week.

name: Create Contributor Map

on:
  schedule:
    - cron: "0 8 * * 1"

jobs:
  build-and-push-image:
    runs-on: ubuntu-latest

    steps:
      - name: Contributor Map
        uses: tunaitis/contributor-map@v1 
Enter fullscreen mode Exit fullscreen mode

A new file "contributor-map.svg" will be committed to your repository at the end of the workflow. You can then include it in your README or any other Markdown document inside your repository using the following syntax:

![Title of the map](contributor-map.svg)
Enter fullscreen mode Exit fullscreen mode

Submission Category:

Wacky Wildcards

Yaml File or Link to Code

GitHub logo tunaitis / contributor-map

Automatically generate a world map showing where contributions to your repository are coming from.

freeCodeCamp contributor map

Introduction

Contributor Map is a GitHub action that automatically generates an SVG world map with countries colored according to the number of received code contributions.

It uses GitHub API to get a list of repository contributors and their profile information. The location field from the public profile is used to determine the country from which the contribution came.

The action can generate a world map for any public GitHub repository.

Usage

Adding the following to an existing workflow would create a new "contributor-map.svg" file inside your repository.

- name: Contributor Map
  uses: tunaitis/contributor-map@v1.1
Enter fullscreen mode Exit fullscreen mode

The following example would generate a map showing contributions of the facebook/react repository and save it to your repository's data folder.

- name: Contributor Map
  uses: tunaitis/contributor-map@v1.1
  with:
    repository: facebbook/react
    output: data/facebook-react.svg
Enter fullscreen mode Exit fullscreen mode

Example of the action inside a workflow that wouild run the action every Monday at 8AM UTC to…

Additional Resources / Info

Other actions used in the workflow:

For the world map generation, a template from Wikipedia is used:

The following open source databases were used to convert user-entered location information to ISO Alpha-2 country codes:

Top comments (0)