anmol098 / waka-readme-stats

This GitHub action helps to add cool dev metrics to your github profile Readme
MIT License
3.39k stars 555 forks source link

BUG: Flag <SHOW_LOC_CHART: "True"> Failed #512

Open liumy-lay opened 4 months ago

liumy-lay commented 4 months ago

Describe the bug The version I Used: anmol098/waka-readme-stats@master

If the Flag SHOW_LOC_CHART is not filled in in YML, the default is "True" .

At the beginning of Github Action Faild, I couldn't find something wrong,

but when I added show_loc_chart: "Flase", GitHub Action was successful.

Here is the detailed bug description:

Traceback (most recent call last):
  File "/waka-readme-stats/main.py", line 230, in <module>
    run(main())
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 6[5](https://github.com/liumy-lay/liumy-lay/actions/runs/10001455264/job/27645080631#step:3:5)3, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 217, in main
    stats = await get_stats()
            ^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 19[6](https://github.com/liumy-lay/liumy-lay/actions/runs/10001455264/job/27645080631#step:3:6), in get_stats
    await create_loc_graph(yearly_data, GRAPH_PATH)
  File "/waka-readme-stats/graphics_chart_drawer.py", line 69, in create_loc_graph
    max_offset = 0.05 * amax(cumulative.flatten())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 282[7](https://github.com/liumy-lay/liumy-lay/actions/runs/10001455264/job/27645080631#step:3:7), in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line [8](https://github.com/liumy-lay/liumy-lay/actions/runs/10001455264/job/27645080631#step:3:8)8, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: zero-size array to reduction operation maximum which has no identity
sys:1: RuntimeWarning: coroutine 'AsyncClient.get' was never awaited

Expected behavior

For new users of Wakatime,to avoid ACTION FAILED the flag SHOW_LOC_CHART should set to False by default in the original code.

image

dappsar commented 3 months ago

Same error with SHOW_LOC_CHART = False. This is the configuration I am using:


on:
  workflow_dispatch:
  schedule:
    # Runs at 00:00AM UTC
    - cron: '30 18 * * *'

jobs:
  update-readme: # https://wakatime.com/projects
    name: Update Readme with Metrics
    runs-on: ubuntu-latest
    steps:
      - uses: anmol098/waka-readme-stats@master #PLEASE USE MASTER BRANCH
        with:
          WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} # https://wakatime.com/api-key
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          SHOW_PROJECTS: "False"
          SHOW_LINES_OF_CODE: "True" 
          SHOW_LOC_CHART: "False"
          LOCALE: "en"