Skip to content

Pac-Man Contribution Graph Game

将你的 GitHub 或 GitLab 贡献图转换成互动的 Pac-Man 游戏!

ref-reporef-online-toolref-official-docref-dependent-action

用法

  1. 在仓库中创建一个 .github/workflows/ 目录。
  2. 添加一个 pacman-contribution.yml 文件,内容如下:
yaml
name: generate pacman game

on:
  # 每 24 小时运行一次
  schedule:
    - cron: "0 */24 * * *"

  # 允许手动触发
  workflow_dispatch:

  # 每次推送到 main 分支都会运行
  push:
    branches:
      - main

jobs:
  generate:
    permissions:
      contents: write
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - name: generate pacman-contribution-graph.svg
        uses: abozanona/pacman-contribution-graph@main
        with:
          github_user_name: ${{ github.repository_owner }}

      # 推送生成的 SVG 到输出分支
      - name: push pacman-contribution-graph.svg to the output branch
        uses: crazy-max/ghaction-github-pages@v3.1.0
        with:
          target_branch: output
          build_dir: dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1. 在你的仓库中,创建或编辑 README.md 文件,以包含:
markdown
## 我的贡献图

<picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/[Owner]/[Repo]/output/pacman-contribution-graph-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/[Owner]/[Repo]/output/pacman-contribution-graph.svg">
    <img alt="吃豆人贡献图" src="https://raw.githubusercontent.com/[Owner]/[Repo]/output/pacman-contribution-graph.svg">
</picture>

参数

点击显示/关闭参数

名称类型必填默认值参数描述更多描述
ref-actions
github_user_namestringtrueGitHub 用户名
github_tokenstringGitHub Token

示例

markdown
<!-- abozanona -->
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/abozanona/abozanona/output/pacman-contribution-graph-dark.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/abozanona/abozanona/output/pacman-contribution-graph.svg">
  <img alt="吃豆人贡献图" src="https://raw.githubusercontent.com/abozanona/abozanona/output/pacman-contribution-graph.svg">
</picture>
吃豆人贡献图

Readme Widget Hub (v4.1.4) MIT Licensed