Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
grid

GitHub Action

Autopopulate your contribution graph

1.0.1

Autopopulate your contribution graph

grid

Autopopulate your contribution graph

This action will automatically push empty commits to one of your GitHub repos

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Autopopulate your contribution graph

uses: bcanseco/[email protected]

Learn more about this action in bcanseco/github-contribution-graph-action

Choose a version

Contribution Graph Action

Quick start without leaving your browser ⚑

  1. Create a new repo (preferably private)
  2. Click on Create a new file
  3. In the Name your file... field, type in .github/workflows/main.yml
  4. Paste in one of the YAML file contents below, depending on what you want to do.
  5. Click the Commit new file button at the bottom of the page. You're all set!

If you change your mind about these commits later, you can delete the repository and they'll disappear from your contribution graph.

Push a commit to master once a day 🍺

# .github/workflows/main.yml

on:
  schedule:
  - cron: '0 12 * * *' # every day at noon

jobs:
  single-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: bcanseco/github-contribution-graph-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GIT_EMAIL: [email protected] # replace me

If you need help with cron job syntax, crontab guru is a great resource.

Backfill a year of commits whenever you push to master 🍻

# .github/workflows/main.yml

on:
  push:
    branches: [ master ]

jobs:
  backfill-commits:
    runs-on: ubuntu-latest
    steps:
    - uses: bcanseco/github-contribution-graph-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GIT_EMAIL: [email protected] # replace me
        MAX_DAYS: 365

Keep reading for more cool stuff like:

  • skipping weekends/weekdays
  • backfilling specific time periods
  • custom commit messages
  • and more!

Environment variables 🌳

Key Description Default value Required?
GITHUB_TOKEN Allows this GitHub Action to make commits for you. Simply pass in ${{ secrets.GITHUB_TOKEN }}. Read more. 🟩
GIT_EMAIL An email address associated with your GitHub account. Without this, contributions won't show up. Read more. 🟩
GIT_BRANCH Must either be the default branch (usually master) or gh-pages for contributions to show up. master
GIT_COMMIT_MESSAGE The message to use for commits made by this GitHub Action. chore(actions): empty commit for contribution graph
ORIGIN_TIMESTAMP The unix timestamp to start commits on. If you set MAX_DAYS greater than 1, commits will be made on days prior to this time. The current timestamp
MAX_DAYS The maximum integer number of days to commit on. If you want to backfill a year of commits, set this to 365. 1
INCLUDE_WEEKDAYS A boolean indicating whether or not to make commits on weekdays. true
INCLUDE_WEEKENDS A boolean indicating whether or not to make commits on weekends. true

Advanced environment variables πŸ§™β€β™‚οΈ

There's also some advanced environment variables you can provide. Click here!

Only set these if you know what you're doing:

Key Description Default value Required?
GIT_HOST You may be able to override this to support a GitHub Enterprise environment. github.com
GIT_SSH_COMMAND ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
GITHUB_ACTOR Set by the GitHub Actions runner
GITHUB_REPOSITORY Set by the GitHub Actions runner

How do I know this is secure? πŸ”’

Explore the code! It's tiny and there aren't many dependencies.

Speaking of dependencies, all production npm dependencies used by this GitHub Action are automatically audited for vulnerabilities. If the badge at the top of this README is green, you're good to go.

If you're still worried about malicious code in this repository, GitHub recommends always using a specific version of any GitHub Actions you add to your repositories. Read more.

- uses: bcanseco/github-contribution-graph-action@master
+ uses: bcanseco/github-contribution-graph-action@v1

As far as data security, there's two sensitive pieces of data that this Action handles:

GITHUB_TOKEN πŸ”‘

GitHub has a great article about the token. It's the standard way that all GitHub Actions interact with GitHub on your behalf. The permissions of this token are both short-lived scoped to the repo only.

You don't need to create this secret yourself; GitHub handles that for you. All you need to do is provide the token in your workflow, job, or step:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

GIT_EMAIL πŸ“§

This GitHub Action requires an email associated with your GitHub account. If you provide a random or throwaway email, contributions won't show up on your GitHub profile. Read more.

Chances are, your email is already public if you're making commits with it. But if you're concerned about privacy, you can do either of the following:

Contribute πŸ‘ͺ

PRs are welcome! Please read the contributing guide. This project is MIT licensed.