my ✨ github repo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update GitHub Actions workflow for snake generation

authored by

Jasper Mayone and committed by
GitHub
90dc3edd 0551e847

+27 -24
+27 -24
.github/workflows/snake.yml
··· 1 - 2 - # GitHub Action for generating a contribution graph with a snake eating your contributions. 1 + # .github/workflows/snake.yml 3 2 name: Generate Snake 4 3 5 - # Controls when the action will run. 6 4 on: 7 5 schedule: 8 - # every 12 hours 9 6 - cron: "0 */12 * * *" 10 - 11 - # This command allows us to run the Action automatically from the Actions tab. 12 7 workflow_dispatch: 13 - 14 - # Also run on every push on the main branch 15 8 push: 16 9 branches: 17 10 - main ··· 19 12 permissions: 20 13 contents: write 21 14 22 - # The sequence of runs in this workflow: 23 15 jobs: 24 - # This workflow contains a single job called "build" 25 16 build: 26 - # The type of runner that the job will run on 27 17 runs-on: ubuntu-latest 28 - 29 - # Steps represent a sequence of tasks that will be executed as part of the job 30 18 steps: 31 - - name: Clone repo 32 - uses: actions/checkout@v3 19 + - name: Checkout 20 + uses: actions/checkout@v4 21 + with: 22 + fetch-depth: 0 33 23 34 - - name: Generate the snake files in './dist/' 24 + - name: Generate snake files 35 25 uses: Platane/snk@v3 36 - id: snake-gif 37 26 with: 38 27 github_user_name: ${{ github.repository_owner }} 39 28 outputs: | ··· 43 32 env: 44 33 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 34 46 - - name: Show build status 47 - run: git status 35 + - name: Stage assets to tracked folder 36 + run: | 37 + mkdir -p assets/snake 38 + cp -f dist/github-contribution-grid-snake.svg assets/snake/github-contribution-grid-snake.svg 39 + cp -f dist/github-contribution-grid-snake-dark.svg assets/snake/github-contribution-grid-snake-dark.svg 40 + cp -f dist/github-contribution-grid-snake.gif assets/snake/github-contribution-grid-snake.gif 41 + 42 + - name: Set timestamp 43 + id: ts 44 + run: echo "iso=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" 48 45 49 - - name: Push new files to the output branch 50 - uses: crazy-max/ghaction-github-pages@v3.1.0 46 + - name: Commit only changed snake assets 47 + uses: stefanzweifel/git-auto-commit-action@v4 51 48 with: 52 - target_branch: snake 53 - build_dir: dist 54 - commit_message: Update snake animations at ${{ github.run_id }} · $(date -u +'%Y-%m-%dT%H:%M:%SZ') 49 + commit_message: "chore(snake): update animations at ${{ steps.ts.outputs.iso }}" 50 + branch: main 51 + file_pattern: | 52 + assets/snake/github-contribution-grid-snake.svg 53 + assets/snake/github-contribution-grid-snake-dark.svg 54 + assets/snake/github-contribution-grid-snake.gif 55 + commit_user_name: jasperbot 🤖 56 + commit_user_email: robot+github@jaspermayone.com 57 + commit_author: jasperbot 🤖 <robot+github@jaspermayone.com> 55 58 env: 56 59 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}