Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error adding enumeration #471

Open
Jayzhuoct opened this issue Aug 30, 2023 · 2 comments
Open

Error adding enumeration #471

Jayzhuoct opened this issue Aug 30, 2023 · 2 comments

Comments

@Jayzhuoct
Copy link

Situation description: I forked this warehouse and added an enumeration of progress based on it. When using it in the workflow, I was prompted that the enumeration value could not be found

    VERSION_1 = "█", "░"
    VERSION_2 = "⣿", "⣀"
    VERSION_3 = "⬛", "⬜"
    VERSION_4 = "🟩", "⬜"
on:
  schedule:
    - cron: '0 20 * * *'
  workflow_dispatch:
jobs:
  update-readme:
    name: Update Readme with Metrics
    runs-on: ubuntu-latest
    steps:
      - uses: Jayzhuoct/waka-readme-stats@master
        with:
          WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          SYMBOL_VERSION: 4
Traceback (most recent call last):
  File "/waka-readme-stats/main.py", line 221, 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 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 208, in main
    stats = await get_stats()
            ^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 180, in get_stats
    stats += await get_waka_time_stats(repositories, commit_data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/main.py", line 36, in get_waka_time_stats
    stats += f"{await make_commit_day_time_list(data['data']['timezone'], repositories, commit_dates)}\n\n"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/graphics_list_formatter.py", line 111, in make_commit_day_time_list
    stats += f"**{title}** \n\n```text\n{make_list(names=dt_names, texts=dt_texts, percents=dt_percents, top_num=7, sort=False)}\n```\n"
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/graphics_list_formatter.py", line 74, in make_list
    data_list = [f"{n[:25]}{' ' * (25 - len(n))}{t}{' ' * (20 - len(t))}{make_graph(p)}   {p:05.2f} % " for n, t, p in top_data]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/graphics_list_formatter.py", line 74, in <listcomp>
    data_list = [f"{n[:25]}{' ' * (25 - len(n))}{t}{' ' * (20 - len(t))}{make_graph(p)}   {p:05.2f} % " for n, t, p in top_data]
                                                                         ^^^^^^^^^^^^^
  File "/waka-readme-stats/graphics_list_formatter.py", line 45, in make_graph
    done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/waka-readme-stats/graphics_list_formatter.py", line [34](https://github.com/Jayzhuoct/Jayzhuoct/actions/runs/6025913086/job/16347696947#step:3:35), in get_symbols
    return Symbol[f"VERSION_{version}"].value
           ~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 795, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'VERSION_4'
sys:1: RuntimeWarning: coroutine 'AsyncClient.get' was never awaited
@caupolicanre
Copy link

Hi, I have the same error, did you find any solution for this?

@caupolicanre
Copy link

Hey! I managed to solve this problem. When you're running your own forked action, you have to modify the action.yml file. Because it creates a Docker image with the original repo's branch master.

Here is the original action.yml file:

runs:
  using: 'docker'
  image: 'docker://wakareadmestats/waka-readme-stats:master'

Here is the modified action.yml file, it uses the Dockerfile found in repository's root folder:

runs:
  using: "docker"
  image: "Dockerfile"

Hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants