Skip to content

gayanvoice/top-github-users-action

Repository files navigation

Top GitHub Users Action Image of my-profile-views-counter

Image of my-profile-views-counter

Check your rank in GitHub! Get the list of active users in GitHub by country using GitHub Graph API. Go to gayanvoice/top-github-users.

How it works?

The list of countries and the cities are sorted in config.json as an array. The octokit/graphql.js fetches the data from GitHub Graph API. After the fetch is completed, it creates a JSON file by country name in ./cache. The checkpoint.json is used to checkpoint the country.

The action gets the list of users and order it by public contributions, total contributions, and number of followers from cache to generate markdowns, and ranking. The ./docs contains the rankings of total public contirubtions by country.

Don't forget to star ⭐ this repository

Technologies

Setup

1 — Create an empty repository and name the repository as top-github-users.

2 — 🔒 Create a new personal access token with repo workflow admin:org user options

Go to Settings -> Developer settings -> Personal Access Tokens and click on Generate new token button. Give it any name and select repo workflow admin:org -> read:org user -> read:user options and click on Generate token button. ✂️ Copy the token.

3 — 🔑 Create a repository secret

Go to your top-github-users repository -> Settings -> Secrets and click on New repository secret button and enter name as CUSTOM_TOKEN and 📋 paste the personal access token under value. Click on Add secret button.

4 — Go to your top-github-users repository -> Actions and click on set up a workflow yourself link to create a new workflow and paste the below content into yml file. Commit changes.

name: Top GitHub Users
on:
  schedule:
    - cron: '0 * * * *'
  workflow_dispatch:
jobs:
  release:
    name: GitHub Active Users
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/[email protected]
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.CUSTOM_TOKEN }}
      - uses: actions/[email protected]
        with:
          node-version: 14.17.0
      - uses: gayanvoice/top-github-users-action@master
        env:
          CUSTOM_TOKEN: ${{ secrets.CUSTOM_TOKEN }}

5 — Go to your top-github-users repository. Create a JSON file checkpoint.json. Copy the content and paste to the checkpoint.json and commit changes.

{"checkpoint":0}

6 — Go to your top-github-users repository. Create a JSON file config.json. Copy the content and paste to the config.json and commit changes.

{
  "devMode": "false",
  "locations":[
    { "country":  "afghanistan", "geoName": "Afghanistan", "cities": ["kabul", "kandahar", "herat", "Kunduz", "lashkargah", "ghazni", "khost", "zaranj"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/9/9a/Flag_of_Afghanistan.svg" },
    { "country":  "albania", "geoName": "Albania", "cities": ["tirana", "durrës", "vlorë", "elbasan", "shkodër", "kamëz", "fier", "korçë"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/3/36/Flag_of_Albania.svg" },
    { "country":  "algeria", "geoName": "Algeria", "cities": ["algiers", "oran", "constantine", "batna", "djelfa", "sétif", "annaba", "sidibelabbès", "biskra", "tiaret"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/7/77/Flag_of_Algeria.svg" },
    { "country":  "andorra", "geoName": "Andorra", "cities": ["andorra-la-vella", "santa-coloma", "la-margineda", "engolasters"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/1/19/Flag_of_Andorra.svg" },
    { "country":  "angola", "geoName": "Angola", "cities": ["luanda", "cabinda ", "huambo", "lubango ", "kuito", "malanje ", "lobito", "benguela"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/9/9d/Flag_of_Angola.svg" },
    { "country":  "argentina","geoName": "Argentina", "cities": ["buenos-aires", "cordoba", "rosario", "la-plata", "tucumán", "mar-del-plata", "salta", "santa-fe"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/1/1a/Flag_of_Argentina.svg" },
    { "country":  "armenia", "geoName": "Armenia", "cities": ["yerevan", "gyumri", "vanadzor", "vagharshapat", "abovyan "], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/2/2f/Flag_of_Armenia.svg" },
    { "country":  "australia", "geoName": "Australia", "cities": ["sydney", "melbourne", "perth", "adelaide", "brisbane", "canberra", "hobart", "gold-coast", "darwin"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/8/88/Flag_of_Australia_%28converted%29.svg" },
    { "country":  "austria", "geoName": "Austria", "cities": ["vienna", "salzburg", "innsbruck", "linz", "graz", "klagenfurt", "bregenz", "villach"], "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/4/41/Flag_of_Austria.svg" }
  ]
}

7 — 📄 Go to your top-github-users repository -> Actions. Select the workflow Top GitHub Users and click on Run workflow button.

Deploy local

1 — Clone this repository to your computer.

2 — Edit index.js 📋 paste the personal access token in AUTH_KEY in https://github.com/gayanvoice/top-github-users-action/blob/master/src/index.js and comment process.env secrets.

    const AUTH_KEY = "ghp_vbmFdybMFCxWzvrgC*************";
    const GITHUB_USERNAME_AND_REPOSITORY = 'gayanvoice/top-github-users';
    // const AUTH_KEY = process.env.CUSTOM_TOKEN;
    // const GITHUB_USERNAME_AND_REPOSITORY = process.env.GITHUB_REPOSITORY;

3 — Run test Run on command line.

npm test

📦 Third party

📄 License

Releases

No releases published

Packages

No packages published