athul / waka-readme

Wakatime Weekly Metrics on your Profile Readme.
https://github.com/athul
MIT License
1.56k stars 301 forks source link

Github Action error: Environment variables are misconfigured #159

Closed rong-xiaoli closed 6 months ago

rong-xiaoli commented 6 months ago

Action log:

[2024-04-28 10:47:07] ln. 519 DEBUG    Initialize WakaReadme
[2024-04-28 10:47:07] ln. 163 DEBUG    Validating input variables
[2024-04-28 10:47:07] ln. 165 ERROR    Invalid inputs
[2024-04-28 10:47:07] ln. 166 INFO     Refer https://github.com/athul/waka-readme
[2024-04-[28](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:29) 10:47:07] ln. 522 ERROR    Environment variables are misconfigured

I suppose it's because my username? No idea about what happend, sorry. Complete log:

Run athul/waka-readme@master
  with:
    COMMIT_MESSAGE: Update Wakapi stats
    BLOCKS: ⬜🟨🟩
    TIME_RANGE: last_30_days
    SHOW_TIME: true
    GH_TOKEN: ***
    REPOSITORY: rong-xiaoli/rong-xiaoli
    SHOW_TITLE: false
    SECTION_NAME: waka
    CODE_LANG: txt
    LANG_COUNT: 5
    SHOW_TOTAL: false
    SHOW_MASKED_TIME: false
    STOP_AT_OTHER: false
    TARGET_BRANCH: NOT_SET
    TARGET_PATH: NOT_SET
    COMMITTER_NAME: NOT_SET
    COMMITTER_EMAIL: NOT_SET
    AUTHOR_NAME: NOT_SET
    AUTHOR_EMAIL: NOT_SET
/usr/bin/docker run --name f91cd1d1d0500de7[2](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:2)64466af0cee[3](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:3)f05939dd1_1cc301 --label f91cd1 --workdir /github/workspace --rm -e "INPUT_API_BASE_URL" -e "INPUT_WAKATIME_API_KEY" -e "INPUT_COMMIT_MESSAGE" -e "INPUT_BLOCKS" -e "INPUT_TIME_RANGE" -e "INPUT_SHOW_TIME" -e "INPUT_GH_TOKEN" -e "INPUT_REPOSITORY" -e "INPUT_SHOW_TITLE" -e "INPUT_SECTION_NAME" -e "INPUT_CODE_LANG" -e "INPUT_LANG_COUNT" -e "INPUT_SHOW_TOTAL" -e "INPUT_SHOW_MASKED_TIME" -e "INPUT_STOP_AT_OTHER" -e "INPUT_IGNORED_LANGUAGES" -e "INPUT_TARGET_BRANCH" -e "INPUT_TARGET_PATH" -e "INPUT_COMMITTER_NAME" -e "INPUT_COMMITTER_EMAIL" -e "INPUT_AUTHOR_NAME" -e "INPUT_AUTHOR_EMAIL" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/rong-xiaoli/rong-xiaoli":"/github/workspace" f91cd1:d1d0500de726[4](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:4)466af0cee3f05939dd1

[2024-04-28 10:47:07] ln. [5](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:5)19 DEBUG    Initialize WakaReadme
[2024-04-28 10:47:07] ln. 1[6](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:6)3 DEBUG    Validating input variables
[2024-04-28 10:4[7](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:7):07] ln. 165 ERROR    Invalid inputs
[2024-04-2[8](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:8) 10:47:07] ln. 166 INFO     Refer https://github.com/athul/waka-readme
[2024-04-28 [10](https://github.com/rong-xiaoli/rong-xiaoli/actions/runs/8867042283/job/24345157223#step:3:10):47:07] ln. 522 ERROR    Environment variables are misconfigured
yozachar commented 6 months ago

Hi, it says Invalid input @ line 165, which is triggered when either of these variables are empty:

https://github.com/athul/waka-readme/blob/1d056b65fe8e5558c8e17d786667099b975f5291/main.py#L164-L166

In your full log, I can see GH_TOKEN and REPOSITORY, can you please double check your secrets for API_BASE_URL and WAKATIME_API_KEY?

rong-xiaoli commented 6 months ago

Oh thanks, I found my API_BASE_URL is not filled. This should be the reason. I'll try and give out result soon.

rong-xiaoli commented 6 months ago

Another question, here: https://github.com/athul/waka-readme/blob/1d056b65fe8e5558c8e17d786667099b975f5291/README.md?plain=1#L169 it says that: API_BASE_URL is optional, so I didn't fill it. Is it optional or I should fill it as an necessary param in my action YAML file?

rong-xiaoli commented 6 months ago

Oh I got it. I messed up. So here's what happend: I followed one's profile page and copied his/her/xer WakaTime YAML config file and didn't check. In that YAML file it wrote:

        with:
          API_BASE_URL: ${{ secrets.WAKAPI_BASE_URL }}
          WAKATIME_API_KEY: ${{ secrets.WAKAPI_API_KEY }}

And what I configured is GH_TOKEN and WAKATIME_API_KEY, but API_BASE_URL is not configured. So that's why this problem happend. My bad not double-checking my YAML file.

Thanks for helping.


Edit 2024-04-29 15:56 UTC0800 I found it not working with the GH_TOKEN filled. So I removed this part.

rong-xiaoli commented 6 months ago

Sorry, mis operation. I got this problem solved.