anmol098 / waka-readme-stats

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

FEAT: Add Symbol style customized by the user (Help with PR) #490

Closed caupolicanre closed 9 months ago

caupolicanre commented 9 months ago

Hi, I requested a new symbol to be added in #489, then I wanted to be able to enter any type of symbol in the yml workflow file. I'm trying to improve the symbol logic, but I keep getting the same error.

First I tried the same logic as the action shows, and did the same as shown in #471, but when I run the action, I receive the same KeyError.

Then I tried using waka-readme logic for handling symbols entered by the user with an enviroment variable. With this implementation, the action works fine, but nothing changes.

I modified the function "make_graph" and using the previous enviroment variable mentioned, check, if it's empty, use "Symbol" class, but if it is not, use the symbol entered by the user.

This is the workflow file:

name: Commits Readme

on:
  workflow_dispatch: # Manual workflow trigger
  schedule:
    - cron: "0 */6 * * *" # Updates every 6 hours

jobs:
  update-readme-commits:
    name: GitHub Commits
    runs-on: ubuntu-latest
    steps:
      - uses: caupolicanre/waka-readme-stats@master
        with:
          WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
          GH_TOKEN: ${{ secrets.GH_TOKEN }}

          # Config
          SECTION_NAME: commits
          SHOW_UPDATED_DATE: false

          # Content
          SHOW_LINES_OF_CODE: false
          SHOW_TOTAL_CODE_TIME: false
          SHOW_PROFILE_VIEWS: false
          SHOW_COMMIT: true
          # SYMBOL_VERSION: 1
          SYMBOL_STYLE: ▰▱
          SHOW_DAYS_OF_WEEK: false
          SHOW_LANGUAGE: false
          SHOW_OS: false
          SHOW_PROJECTS: false # Investigate to replicate languages format to show projects programming time
          SHOW_TIMEZONE: false
          SHOW_EDITORS: false
          SHOW_LANGUAGE_PER_REPO: false
          SHOW_SHORT_INFO: false
          SHOW_LOC_CHART: false          

          # Commit
          COMMIT_BY_ME: false
          COMMIT_USERNAME: GitHubActionBot
          COMMIT_EMAIL: action-bot@github.com

In this 2 commits are the modifications I made: make_graph function logic enviroment variable

oHTGo commented 9 months ago

Hi @caupolicanre, the GH actions may run by Docker image. Please add a debug log to check. image image

caupolicanre commented 9 months ago

Hi @caupolicanre, the GH actions may run by Docker image. Please add a debug log to check. image image

@oHTGo The debug log you mention is done by using the "DEBUG_LOGGING" enviroment variable in the yml workflow file? or is it a configuration in Docker? I have very little experience working with docker.

I just tried enabling DEBUG_LOGGING in the workflow file, here is the job with the debug messages.

Should I modify "action.yml" file?

caupolicanre commented 9 months ago

I just fixed. The problem was that the action.yml file was using:

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

I modified it to run and test my action with "Dockerfile" file located in root repository:

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