Code Monkey home page Code Monkey logo

waka-box's Introduction

waka-box

Update a pinned gist to contain your weekly WakaTime stats


📌✨ For more pinned-gist projects like this one, check out: https://github.com/matchai/awesome-pinned-gists

Setup

Prep work

  1. Create a new public GitHub Gist (https://gist.github.com/)
  2. Create a token with the gist scope and copy it. (https://github.com/settings/tokens/new)
  3. Create a WakaTime account (https://wakatime.com/signup)
  4. In your WakaTime profile settings (https://wakatime.com/settings/profile) ensure Display coding activity publicly and Display languages, editors, operating systems publicly are checked.
  5. In your account settings, copy the existing WakaTime API Key (https://wakatime.com/settings/api-key)

Project setup

  1. Fork this repo

  2. Edit the environment variable in .github/workflows/schedule.yml:

    • GIST_ID: The ID portion from your gist url: https://gist.github.com/matchai/6d5f84419863089a167387da62dd7081.
  3. Go to the repo Settings > Secrets

  4. Add the following environment variables:

    • GH_TOKEN: The GitHub token generated above.
    • WAKATIME_API_KEY: The API key for your WakaTime account.

waka-box's People

Contributors

alanhamlett avatar antct avatar casperdcl avatar demget avatar dependabot[bot] avatar exoego avatar hephaest avatar matchai avatar petrspelos avatar zhanyeye avatar ziishaned avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

waka-box's Issues

Is enabling Actions of the forked repository required when setup?

At first I failed to update my gist completing all the steps in README. Then I found a step "Open the 'Actions' tab of your fork and click the 'enable' button" in another box project's README (Step 2 of "Project setup") (https://github.com/maxam2017/productive-box). I re-forked this repository, tried this step, and followed the following steps, then I found my gist successfully updated. Is enabling Actions of the forked repository required when setup? If so, I suggest add this step in place in README.

run failed

I got this msg:

(node:1608) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400
    at createError (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:372:15)
    at settle (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:6127:11)
    at IncomingMessage.handleStreamEnd (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:7027:15)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:1608) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1608) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

see: https://github.com/eryajf/Weekly-development-breakdown/runs/7588551751?check_suite_focus=true

Action can't create gist file correctly.

Situation:

  • User uses social login from Github.
  • Completing the operation in the readme.
  • First time gist file name update right, but the file content didn't change.
  • Second time will error, and file lost.

Solution:
The user needs to complete the FillName and UserName to create the file correctly. wakatime user profile

Support Wakapi

The upstream jaebradley/wakatime-client just introduced support for custom API URLs, which enables to access third-party WakaTime replacements like Wakapi or hakatime. I'd find it cool if waka-box had an option to configure a custom URL in the environment to integrate with these tools. In addition, a brief bit of documentation about what settings need to be made accordingly would probably be helpful as well.

What do you think? If this is a wanted feature I can surely do a PR.

Action deletes the file within the gist

After following the steps outline in the README, I trigger the GH action and the file within the gist remains unchanged on the first attempt but changes the title of the gist to "Weekly development breakdown". On a second trigger of the action, the file within the gist is actually deleted and the title reverts to the generic title gist:<id> title. The logs in the action seem completely fine on those first 2 runs yet something is clearly going wrong (see here).

Additional steps taken:

  • Recreated a new gist -> same issue
  • Recreate a new token -> same issue
  • Deleted the repo and started fresh with reforked repo, new gist, and new token -> same issue

References:
gist
forked repo

Any clue at what is going on here?

More explication on the set-up please?

Hi,
Could you precise more the set-up, at the end, what does one have to do, after adding the environment variables?
Is it some code to run by yourself on your own laptop, every week?
Is it running somewhere on some cloud? Is it going to run by itself thanks to GitHub "actions" or something automatic like this?
Thanks for the details!
@Naereen

PS it looks very nice, good job 👍

Run failure: TypeError: Cannot read properties of undefined (reading 'length')

On the Update gist part of the action, I get this error:

Run matchai/waka-box@master
/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:861
      for (let t = 0; t < Math.min(e.data.languages.length, 5); t++) {
                                                    ^

TypeError: Cannot read properties of undefined (reading 'length')
    at updateGist (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:861:53)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async main (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:848:7)
    at async /home/runner/work/_actions/matchai/waka-box/master/dist/index.js:901:7

I checked on my dashboard and though I just created the account I do have logs for two languages so it shouldn't be getting an error. I checked that my token and API key were correct as well.

project stops working

the project stops updating. error is "The log was not found. It may have been deleted based on retention settings."

Update gist error with "null" data

It's a good tool and help me record programming.
But, if there has not any record at the past week, the waka-box Action will throw a error, just like:
HttpError: Validation Failed: {"resource":"Gist","code":"missing_field","field":"files"}

image

It caused a empty gist, and the pinned waka-box displayed empty.

Can't update gist

I keep getting this error in Update gist

Run matchai/waka-box@master
  env:
    GH_TOKEN: ***
    GIST_ID: 0f60ec908f30876824e2827861fc5489
    WAKATIME_API_KEY: ***
/usr/bin/docker run --name e4e3ab205979c5dc441d79c00656b373043b7_6726f2 --label 2e4e3a --workdir /github/workspace --rm -e GH_TOKEN -e GIST_ID -e WAKATIME_API_KEY -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=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/waka-box/waka-box":"/github/workspace" 2e4e3a:b205979c5dc441d79c00656b373043b7
(node:1) UnhandledPromiseRejectionWarning: RangeError: Invalid count value
    at String.repeat (<anonymous>)
    at generateBarChart (/github/workspace/index.js:71:26)
    at updateGist (/github/workspace/index.js:36:7)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async main (/github/workspace/index.js:17:3)
    at async /github/workspace/index.js:76:3
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

this is the gist https://gist.github.com/MarchWorks/0f60ec908f30876824e2827861fc5489

the fork actions https://github.com/MarchWorks/waka-box/actions

Seems like the problem is here

const barsEmpty = size - barsFull - 1;

github action create gist file error

first time it can make file,but file content not change
and second time the file lose, and console print:
Unable to update gist
HttpError: Validation Failed: {"resource":"Gist","code":"missing_field","field":"files"}

cause: wakatime has not data (last 7 days from yesterday)

incomplete pinned gist page

Hi @matchai

I found the pinned gist page cannot fully display when I switch from Windows to Mac. It means that the percentage symbol disappears from the view. This is because that visible length is quite small in 15-inch MacBook.

I am wondering why we need to reserve 11 spaces for the language name while the maximum length for 10 space looks more reasonable (etc., "JavaScript" and "TypeScript" is 10-character-word)

So maybe 10 instead of 11 is the best resolution for cross-platform?

I have a question😁

Hello, I hope to update the data updated by waka-box into the Markdown file, may I ask how to do it?

Increase number of languages

Hello!

Have you tinker with the idea of increasing or make it possible to have dynamic number of programming languages?

5 is small, from Wakatime leaderboards in average each developer works in 8~10 different programming languages.

I can PR it.

No longer trigger github action in forked repository

Now that we are posting this issue, we seem to be unable to use Github Action on a forked repository.

Perhaps there is no other way to go back to Circle CI or host it on your own, but please let me know if you have any good ideas.

The percentage text gets overflown outside of the gist container

Real nice work out there! Really appreciate waka-box and looking into starship now since it's drawn my attention. Anyway, have you been aware of this issue? I looked into your profile and it actually reproduces there. I think GitHub introduced a change at some point and broke the style.

CleanShot 2021-09-17 at 16 17 56@2x

Unable to get gist to update... Requesting help.


Run matchai/waka-box@master
(node:2499) UnhandledPromiseRejectionWarning: Error: Request failed with status code 401
    at createError (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:372:15)
    at settle (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:6118:11)
    at IncomingMessage.handleStreamEnd (/home/runner/work/_actions/matchai/waka-box/master/dist/index.js:7018:15)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:2499) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2499) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My waka-box repo: https://github.com/rlam3/waka-box
GIST: https://gist.github.com/rlam3/f66b68a6bcd096a4f732e1e4c2e16323

I did notice that we needed to create an environment before we can add secrets. Was there a specific name we had to give this property? I use 'master' as my environment.

@matchai

I'm receiving the following error. Where do I begin to debug? Thanks!

Too big names

If programming language is too big, it would cause that bug

Screenshot_2020-01-06-13-10-27-696_com android chrome

Error While Running in Github Actions

Hi There

i am trying to use this. but the build keeps failing

below is the error

husky > setting up git hooks
Can't find .git, skipping Git hooks installation.
Please check that you're in a cloned repository or run 'git init' to create an empty Git repository and reinstall husky.
added 118 packages in 2.78s
 ---> c139b9f3c366
Step 8/9 : COPY . .
 ---> b22be3af2e2f
Step 9/9 : ENTRYPOINT ["node", "index.js"]
 ---> Running in 3730a2e3a038
 ---> ccfc3f82d7a6
Successfully built ccfc3f82d7a6
Successfully tagged gcr.io/gct-12-k5ytrsuh3ccqn8dwf3qf8k5/2e80e41d2b8a4d20e10a5adc527c061627b84ee7a6fbb1e6133f9f47f87f48fa/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1:fc613b4dfd6736a7bd268c8a0e74ed0d1c04a959f59dd74ef2874983fd443fc9
Already have image (with digest): gcr.io/github-actions-images/action-runner:latest
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/github/workspace/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

### FAILED update-gist 01:23:09Z (26.226s)

Buffer Error

buffer.js:327
throw new ERR_INVALID_ARG_TYPE(
^

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
at Function.from (buffer.js:327:9)
at new e (C:\Users\resel\Downloads\waka-box-master\waka-box-master\dist\index.js:6476:26)
at Object.104 (C:\Users\resel\Downloads\waka-box-master\waka-box-master\dist\index.js:844:15)
at webpack_require (C:\Users\resel\Downloads\waka-box-master\waka-box-master\dist\index.js:9:10)
at startup (C:\Users\resel\Downloads\waka-box-master\waka-box-master\dist\index.js:15:12)
at C:\Users\resel\Downloads\waka-box-master\waka-box-master\dist\index.js:17:10
at Object. (C:\Users\resel\Downloads\waka-box-master\waka-box-master\dist\index.js:18:3)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32) {
code: 'ERR_INVALID_ARG_TYPE'
}

Why do manage GIST_ID values differently from GH_TOKEN values?

Why do I manage GIST_ID values differently from GH_TOKEN values?
This will force modification of unnecessary source code.
Although this is not the actual private key, I think you can manage the repository's history a bit cleaner if you manage it the same way.

If you agree, I will send a pull request for this issue.

How much time it takes to appear for 1st time

  • I have followed all the steps but I am not getting it displayed
  • I read that you are using only 1 commit so I think maybe it's because of your cron job timing

Below is the image of what It's showing me in gists | My github pinned gist is shown empty

image

Fix README: Add step about the schedule.yml.

In README.md section "Project setup" step2, there should be addition step:

change uses: matchai/waka-box@master to uses: <YOUR GITHUB NAME>/waka-box@master,

or just delete this uses?

Not updating

Hey! I change the cron to run every minute and I left it running over night, nothing changed in the gist. My wakatime profile says the correct stats but not the gist, yes I have the correct API key and the correct gist id, it just won't update!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.