Coder Social home page Coder Social logo

abhisheknaiidu / todoist-readme Goto Github PK

View Code? Open in Web Editor NEW
137.0 5.0 50.0 252 KB

🚧 Updates README with Todoist Stats of a user

Home Page: https://github.com/marketplace/actions/todoist-readme

License: Creative Commons Zero v1.0 Universal

JavaScript 100.00%
todoist todoist-api todoist-tasks time-tracker github-actions github-readme

todoist-readme's Introduction

🚧 Todoist Stats

⚡️📌 Update your Todoist Stats ✅


Setup

Prep work

  1. You'll need a Todoist API Token. You can get that from here
    • if you're new to Todoist, then you can refer here.
  2. You need to save the Todoist API Token in the repository secrets. You can find that in the Settings of your Repository. Be sure to save those as the following.
    • TODOIST_API_KEY = <your todoist API token>
  3. You need to update the README file(README.md) with 2 comments. You can refer here for updating it.

Update your README

Add a comment to your README.md like this:

# Todoist Stats

<!-- TODO-IST:START -->
<!-- TODO-IST:END -->

These lines will be our entry-points for the todoist stats.

New to Todoist

Todoist gives you the confidence that everything’s organized and accounted for, so you can make progress on the things that are important to you.

  • Create a Todoist account from here
  • Get your Todoist API Key from your here

Repository Workflow For Non-Premium Users

Please follow the steps below:

  1. Go to your <username>/<username>/actions, hit New workflow, set up a workflow yourself, delete all the default content github made for you.
  2. Copy the following code and paste it to your new workflow you created at step 1:
name: Todoist Readme

on:
  workflow_dispatch:
  schedule:
    # Runs every minute
    - cron: "* * * * *"

jobs:
  update-readme:
    name: Update todoist stats
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: abhisheknaiidu/todoist-readme@master
        with:
          TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}
          PREMIUM: ""
  1. Go to your repo secrets by hitting Settings => Secrets tab in your profile repo. You can also enter the url https://github.com/USERNAME/USERNAME/settings/secrets . Please replace the USERNAME with your own username.
  2. Create a new Secret. Name: TODOIST_API_KEY, Value: Paste the Todoist API Token here. If you don't know what is the token, please go to here to find your API Key there.
  3. Add a comment to your README.md like this:
# Todoist Stats

<!-- TODO-IST:START -->
<!-- TODO-IST:END -->
  1. Go to Workflows menu (mentioned in step 1), click Todoist Readme, and click Run workflow.
  2. Go to your profile page. you will be able to see it.

Repository Workflow For Premium Users

Please follow the steps below:

  1. Go to your <username>/<username>/actions, hit New workflow, set up a workflow yourself, delete all the default content github made for you.
  2. Copy the following code and paste it to your new workflow you created at step 1:
name: Todoist Readme

on:
  workflow_dispatch:
  schedule:
    # Runs every minute
    - cron: "* * * * *"

jobs:
  update-readme:
    name: Update todoist stats
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: abhisheknaiidu/todoist-readme@master
        with:
          TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}
          PREMIUM: true
  1. Remaining Steps will be same as Non-Premium Users.

License

CC0

To the extent possible under law, Abhishek Naidu has waived all copyright and related or neighboring rights to this work.

Inspired by yg/todoist-box

Inspired by gautamkrishnar/blog-post-workflow

todoist-readme's People

Contributors

abhisheknaiidu avatar ypresion 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

todoist-readme's Issues

Add GitHub actions

Addition of GitHub actions will help to enhance the code quality and workflow or repository.
try to add ESLint and prettier Actions.

Permission to [PROFILE].git denied to github-actions[bot]

Hello,

I am having issue when running it, how may I change the User used in the script to commit?

4
Writing to ./README.md
Started: git config --global user.email [email protected]
Started: git config --global user.name Abhishek Naidu
Started: git add ./README.md
Started: git commit -m Todoist updated.
[preview fdc8[6](https://github.com/aldoyh/aldoyh/actions/runs/5378707166/jobs/9758875236#step:3:7)05] Todoist updated.
 1 file changed, 4 insertions(+)
Started: git push
remote: Permission to aldoyh/aldoyh.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/aldoyh/aldoyh/': The requested URL returned error: 403
/home/runner/work/_actions/abhisheknaiidu/todoist-readme/master/dist/index.js:3593
      const err = new Error(`Invalid status code: ${code}`);
                  ^

Error: Invalid status code: 128
    at ChildProcess.<anonymous> (/home/runner/work/_actions/abhisheknaiidu/todoist-readme/master/dist/index.js:3593:19)
    at ChildProcess.emit (node:events:52[7](https://github.com/aldoyh/aldoyh/actions/runs/5378707166/jobs/9758875236#step:3:8):2[8](https://github.com/aldoyh/aldoyh/actions/runs/5378707166/jobs/9758875236#step:3:9))
    at maybeClose (node:internal/child_process:10[9](https://github.com/aldoyh/aldoyh/actions/runs/5378707166/jobs/9758875236#step:3:10)2:[16](https://github.com/aldoyh/aldoyh/actions/runs/5378707166/jobs/9758875236#step:3:17))
    at Process.ChildProcess._handle.onexit

Screenshot 2023-06-26 at 16 28 20

Add pull request and issue templates

Adding issue templates and pull request template will enhance the workflow of the repository.

Use the new form of ISSUE_TEMPLATE i.e. making a folder ISSUE_TEMPLATE in .github and adding different types of .md files for different issues like bug.md, documentation.md and feature.md. A contributor can choose the type of templates whenever they make an issue.

Reference: https://docs.github.com/en/github/building-a-strong-community/about-issue-and-pull-request-templates

Highlight the text of stats

Right Now, the todoist readme stats are just in normal text format, it can be highlighed by using ``

Try to make in this format:

todoist-stats

PREMIUM variable type issue

Hi,
I am a non-preminum user in todoist.
So, I set up the workflow yaml file as follows according to the settings you gave me.

name: Todoist Readme

on:
  workflow_dispatch:
  schedule:
    # Runs every minute 
    - cron: '* * * * *'

jobs:
  update-readme:
    name: Update todoist stats
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: abhisheknaiidu/todoist-readme@master
        with:
          TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}

However, when I checked the github action log, the following error occurred.
Run abhisheknaiidu/todoist-readme@master with: TODOIST_API_KEY: *** USERNAME: jaejin1 PREMIUM: false (node:2894) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'total_completed' of undefined at updateReadme (/home/runner/work/_actions/abhisheknaiidu/todoist-readme/master/dist/index.js:486:57) at main (/home/runner/work/_actions/abhisheknaiidu/todoist-readme/master/dist/index.js:465:11) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async /home/runner/work/_actions/abhisheknaiidu/todoist-readme/master/dist/index.js:587:5 (node:2894) 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:2894) [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.

When checking the code, it seems that the PREMIUM variable is read as a string type from the yaml file.
The line of code is https://github.com/abhisheknaiidu/todoist-readme/blob/master/dist/index.js#L485.

So I tested it by giving the PREMIUM value "", and it succeeded.

with:
     TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}
     PREMIUM: ""

Create and share a PR with the issue.

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.