TypeScript Github-Action

Github Profile Repositories

Automatically create repositories list for your Github Profile.

Github Profile Repositories

Name: github-profile-repositories

Automatically create repositories list for your Github Profile.

Template file

This action required a template file which it’s required input template-file. The template file will render by LiquidJS. You can find the example template file here. The template file will render to required input render-file.

Template Parameters

Template parameters will following data from Github GraphQL API. Repository and PullRequest

repositories

>repositories [
  {
    name
    url
    stargazerCount
    forkCount
    isPrivate
    description
    createdAt
    updatedAt
    primaryLanguage {
      name
      color
    }
  }
]

contributed

>contributed [
  {
    name
    url
    stargazerCount
    forkCount
    isPrivate
    description
    createdAt
    updatedAt
    primaryLanguage {
      name
      color
    }
    owner {
      login
    }
    contributions [
      {
        occurredAt
        pullRequest {
          title
          url
          createdAt
          updatedAt
          closed
          closedAt
          merged
          mergedAt
        }
      }
    ]
  }
]

Inputs

github-token - This action required Github Token which it’s required input. The token will use to query owner repositories and contributions repositories to the Github GraphQL API. The token required scopes repo:status, public_repo, and user:email to commit the rendered file if need. required.

template-file - The file template to render. required.

render-file - The rendered out put file. required.

limit - The limit number of repositories will render, max 25. Default 10.

repositories-order-by - The method to sort the repositories list. Support (STARGAZERS|CREATED_AT|UPDATED_AT|PUSHED_AT|NAME). Default STARGAZERS.

contributed-order-by - The method to sort the contributed repositories list. Support (STARGAZERS|OCCURRED_AT). Default STARGAZERS.

Examples

Simple

name: Generate Github Profile
on: push

jobs:
  github-profile:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Github Profile Repositories
        uses: ntsd/github-profile-repositories@master
        with:
          github-token: "${{ secrets.MY_GITHUB_TOKEN }}"
          template-file: "./TEMPLATE.md"
          render-file: "./README.md"
      - name: Commit files
        run: |
          git config --local user.email "[email protected]"
          git config --local user.name "ntsd"
          git commit -am "docs: auto update README.md"
          git push

Full configs

name: Generate Github Profile
on: push

jobs:
  github-profile:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Github Profile Repositories
        uses: ntsd/github-profile-repositories@master
        with:
          github-token: "${{ secrets.MY_GITHUB_TOKEN }}"
          template-file: "./TEMPLATE.md"
          render-file: "./README.md"
          limit: 20
          repositories-order-by: "UPDATED_AT"
          contributed-order-by: "OCCURRED_AT"
      - name: Commit files
        run: |
          git config --local user.email "[email protected]"
          git config --local user.name "ntsd"
          git commit -am "docs: auto update README.md"
          git push

Resources

https://docs.github.com/en/graphql/overview/explorer

https://docs.github.com/en/graphql/reference/objects#contributionscollection