Generate Snake Animation #3653
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Action for generating a contribution graph with a snake eating your contributions. | |
name: Generate Snake Animation | |
# Controls when the action will run. This action runs every 6 hours. | |
on: | |
schedule: | |
# every 6 hours | |
- cron: '0 */6 * * *' | |
# This command allows us to run the Action automatically from the Actions tab. | |
workflow_dispatch: | |
# The sequence of runs in this workflow: | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks repo under $GITHUB_WORKSHOP, so your job can access it | |
- uses: actions/checkout@v4 | |
# Generates the snake | |
- uses: Platane/snk@v3 | |
id: github-contribution-grid-snake-animation | |
with: | |
# github user name to read the contribution graph from (**required**) | |
# using action context var `github.repository_owner` or specified user | |
github_user_name: ${{ github.repository_owner }} | |
# these next 2 lines generate the files on a branch called "output". This keeps the main branch from cluttering up. | |
# gif_out_path: dist/github-contribution-grid-snake.gif | |
# svg_out_path: dist/github-contribution-grid-snake.svg | |
# list of files to generate. | |
# one file per line. Each output can be customized with options as query string. | |
# | |
# supported options: | |
# - palette: A preset of color, one of [github, github-dark, github-light] | |
# - color_snake: Color of the snake | |
# - color_dots: Coma separated list of dots color. | |
# The first one is 0 contribution, then it goes from the low contribution to the highest. | |
# Exactly 5 colors are expected. | |
outputs: | | |
dist/github-contribution-grid-snake.svg | |
dist/github-contribution-grid-snake-dark.svg?palette=github-dark | |
dist/ocean.svg?color_snake=orange&color_dots=#bfd6f6,#8dbdff,#64a1f4,#4b91f1,#3c7dd9 | |
env: | |
# a github token is required to fetch the contribution calendar from github API | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Show the status of the build. Makes it easier for debugging (if there's any issues). | |
- run: git status | |
# Push the changes | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
force: true | |
# push the content of <build_dir> to a branch | |
# the content will be available at https://raw.githubusercontent.com/<github_user>/<repository>/<target_branch>/<file> , or as github page | |
- name: push github-contribution-grid-snake.svg to the output branch | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
# the output branch we mentioned above | |
target_branch: output | |
build_dir: dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |