效果图

这是开发者大佬的github主页

image-20230516193849346

教程

1.新建一个与你GitHub用户名同名的仓库

此步骤略

2.进入action

image-20230516194224640

3.新建workflow

image-20230516194425241

填入你的GitHub用户名

image-20230516194506566

选择configure

image-20230516194626301

4.填写代码

你应该会看到这个页面

image-20230516194755614

去掉原来的所有内容,填入以下内容

# GitHub Action for generating a contribution graph with a snake eating your contributions.

name: Generate Snake

on:
  schedule:
    - cron: "0 0 * * *"
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.4
      
      - name: Generate Snake
        uses: Platane/snk@master
        id: snake-gif
        with:
          github_user_name: ${{ github.repository_owner }}
          gif_out_path: ./assets/github-contribution-grid-snake.gif
          svg_out_path: ./assets/github-contribution-grid-snake.svg

      - name: Push to GitHub
        uses: EndBug/add-and-commit@v7.2.1
        with:
          branch: main
          message: 'Generate Contribution Snake'

image-20230516194917314

5.运行

image-20230516195002555

回到action页面,点击运行即可

6.为REDAME.md加上贪吃蛇图片

在你的仓库的REDAME.md文件中加入以下内容

![](https://raw.githubusercontent.com/你的GitHub用户名/你的GitHub用户名/main/assets/github-contribution-grid-snake.svg)

7.成功

image-20230516195320000