Giter Site home page Giter Site logo

jieding / github-followers-action Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 116 KB

A GitHub Action ranks your followers according to different criteria(number of their followers, credits of their repos, number of their contributions and number of people they're following). It also renders those data into HTML elements so that those ranked followers can be easily displayed in your GitHub profile.

License: Apache License 2.0

Go 79.31% Smarty 11.64% Dockerfile 9.04%

github-followers-action's Introduction

GitHub Followers Logo

GitHub Followers Display Action ๐Ÿ‘ฅ

License Language Code coverage status badge Release version badge Github marketplace badge

Do you want to show your followers in your GitHub profile? Do you want to know which of your followers are more active or have a better influence? This github-followers-action ranks your followers according to different criteria(number of their followers, credits of their repos, number of their contributions and number of people they're following). It also renders those data into HTML elements so that those ranked followers can be easily displayed in your GitHub profile. This action is inspired by ouuan's Profile.

Getting Started ๐Ÿš€

Set up Your Profile Repo

Create a Repository, and name it as your username. See my example here.

Username/Username is a special repository since its README.md will appear on your public profile.

Set Start and End Flags

Once created your profile, you can add whatever you want into the README.md.

The only thing you need to do is to add following flags to your README.md, so the action knows where to place your ranked followers.

The start and end flag:

<!--ACTION_START_FLAG:github-followers-->
<!--ACTION_END_FLAG:github-followers-->

An example of README.md (before adding flags):

Hi there ๐Ÿ‘‹

This is JieDing. 

Here are some fun facts: ......

After adding two flags:

Hi there ๐Ÿ‘‹

This is JieDing. 

Here are some fun facts: ......

<!--ACTION_START_FLAG:github-followers-->
<!--ACTION_END_FLAG:github-followers-->

Build Your Workflow

Create the directory .github/workflows in the Username/Username repository.

Add the following example to .github/workflows directory.

github-followers.yml

on:
  push:
    branches:
      - main
  schedule:
    - cron: '0 20 * * *'
jobs:
  github_followers_job:
    runs-on: ubuntu-latest
    name: A job to display github followers in your profile
    steps:
      - uses: actions/checkout@v3

      - name: use github-follower-action to update README.md
        id: github-follower
        uses: JieDing/github-followers@main
        env:
          login: ${{ github.repository_owner }}
          pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - name: Commit changes
        run: |
            git config --local user.email "[email protected]"
            git config --local user.name "GitHub Action"
            git add -A
            git diff-index --quiet HEAD || git commit -m "Update GitHub followers"
      - name: Pull changes
        run: git pull -r
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: ${{ github.ref }}

The workflow above basically did three things:

  1. Use checkout action to enable your workflow to access your Username/Username repository.
  2. Use github-followers action to select top followers and render their information into HTML elements, finally write these elements into your README.md.
  3. Use git-related actions to commit changes, and enable actions-user to automatically push changed README.md to you profile repository.

โš ๏ธ NOTE: You don't need to create variables like github.ref, github.repository_owner or secrets.GITHUB_TOKEN, used in the above example.

โš ๏ธ NOTE: But you need to create a secret called PERSONAL_ACCESS_TOKEN in your repository. See Set your PAT and Create an Encrypted Secret for details.

Configuration

You may have noticed that the workflow requires some variables to work.

The following variables must be configured in order to make github-followers action work.

Key Required Value Description
login true Your login ID. You can use ${{ github.repository_owner }} to get your login ID here.
pat true Your Personal Access Token(PAT). In order to obtain your followers' information by GraphQL query, you have to set a valid PAT.

Set Your PAT

You can create a PAT by following this step-by-step instruction.

When you select the scopes, or permissions, you'd like to grant this token, make sure following scopes are enabled:

repo
repo:status
repo_deployment
public_repo
read:org
read:public_key
read:repo_hook
user
read:gpg_key

Create an Encrypted Secret for Your Repository

Create an encrypted secret, which holds PERSONAL_ACCESS_TOKEN as the key and the PAT you just created as the value.

Check out the instruction about how to create encrypted secrets for a repository.

github-followers-action's People

Contributors

actions-user avatar

Stargazers

Doug Eisenstein avatar Song Ouyang avatar it985 avatar wells avatar MikeG avatar Chris avatar Jay avatar

Watchers

Jay avatar

Forkers

songjiayang

github-followers-action's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.