Platane / snk

🟩⬜ Generates a snake game from a github user contributions graph and output a screen capture as animated svg or gif
https://platane.github.io/snk
4.22k stars 1.03k forks source link

Fix for Action failed with "Cannot read properties of undefined (reading 'split')" #77

Closed aelassas closed 1 year ago

aelassas commented 1 year ago

Now, GitHub client returns the user's contributions as an HTML table, instead of a generated svg. The source code was updated to fix this issue.

snk/svg-only action was updated too.

Here is the working fork: https://github.com/aelassas/snk

You can test it with the following action:

name: snake

on:
  # run automatically every 24 hours
  schedule:
    - cron: "0 */24 * * *" 

  # allows to manually run the job at any time
  workflow_dispatch:

  # run on every push on the master branch
  push:
    branches:
    - master

jobs:
  generate:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      # generates a snake game from a github user (<github_user_name>) contributions graph, output a svg animation at <svg_out_path>
      - name: generate github-contribution-grid-snake.svg
        uses: aelassas/snk/svg-only@main
        with:
          github_user_name: ${{ github.repository_owner }}
          outputs: |
            dist/github-contribution-grid-snake.svg
            dist/github-contribution-grid-snake-dark.svg?palette=github-dark

      # 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@v3.1.0
        with:
          target_branch: output
          build_dir: dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ijsbol commented 1 year ago

Appears to be working as expected (ref: my profile), should be good to merge.

milaabl commented 1 year ago

@aelassas , yup, it's working πŸ•ΊπŸ‘πŸ‘πŸ‘My action run: https://github.com/milaabl/milaabl-readme/actions/runs/5566208391

jjsair0412 commented 1 year ago

It's working My README ! Thank you for your help πŸ‘ :)

Platane commented 1 year ago

Thanks for looking into that

As @Zxilly pointed in https://github.com/Platane/snk/issues/75#issuecomment-1637532509, it will be safer to use the proper github api rather than parsing the dom (which will be subject to change again in the future)

I will push a fix today :+1:

Good job on the patch though ( and on deciphering the release steps :D )