name: Generate Snake on: schedule: - cron: "0 */12 * * *" # 每 12 小时更新一次 workflow_dispatch: # 支持手动触发 # 说明:不使用 push 触发,避免本工作流提交后自我循环触发 permissions: contents: write jobs: generate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # 生成贡献蛇(浅色 + 深色两版,自动适配主题) - name: Generate snake SVG uses: Platane/snk/svg-only@v3 with: github_user_name: ${{ github.repository_owner }} outputs: | profile/snake.svg profile/snake-dark.svg?palette=github-dark # 提交生成的蛇到仓库(与 stats.yml 保持同样的提交模式) - name: Commit snake run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add profile/snake.svg profile/snake-dark.svg git commit -m "Update snake" || exit 0 git push