From d02f98c5e3bcda3719995a4dce206f90408269ee Mon Sep 17 00:00:00 2001 From: abhisheknaiidu Date: Fri, 27 Nov 2020 20:04:00 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20fix=20for=20non-premium=20users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 100 +++++++++++++++++++++++++++++------------------------- index.js | 2 +- 2 files changed, 54 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index d35cec0..c8fff15 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ ### Prep work 1. You'll need a Todoist API Token. You can get that from [here](https://beta.todoist.com/prefs/integrations) - - if you're new to Todoist, then you can refer [here](#new-to-todoist). + - if you're new to Todoist, then you can refer [here](#new-to-todoist). 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 = ` + - `TODOIST_API_KEY = ` 3. You need to update the README file(README.md) with 2 comments. You can refer [here](#update-your-readme) for updating it. ## Update your README @@ -22,6 +22,7 @@ Add a comment to your `README.md` like this: ```markdown # Todoist Stats + ``` @@ -41,37 +42,41 @@ Please follow the steps below: 1. Go to your `//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: - ```yml - 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 }} - ``` -3. 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. -4. 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](https://beta.todoist.com/prefs/integrations) to find your API Key there. + +```yml +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: "" +``` + +3. 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. +4. 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](https://beta.todoist.com/prefs/integrations) to find your API Key there. 5. Add a comment to your `README.md` like this: ```markdown # Todoist Stats + ``` -6. Go to Workflows menu (mentioned in step 1), click `Todoist Readme`, and click `Run workflow`. -7. Go to your profile page. you will be able to see it. +6. Go to Workflows menu (mentioned in step 1), click `Todoist Readme`, and click `Run workflow`. +7. Go to your profile page. you will be able to see it. ### Repository Workflow For Premium Users @@ -79,35 +84,36 @@ Please follow the steps below: 1. Go to your `//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: - ```yml - 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 - ``` + +```yml +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 +``` + 3. Remaining Steps will be same as Non-Premium Users. -## License +## License [![CC0](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) To the extent possible under law, [Abhishek Naidu](https://abhisheknaidu.tech/) has waived all copyright and related or neighboring rights to this work. - _Inspired by [yg/todoist-box](https://github.com/yg/todoist-box)_ _Inspired by [gautamkrishnar/blog-post-workflow](https://github.com/gautamkrishnar/blog-post-workflow)_ diff --git a/index.js b/index.js index d19a789..7b66c00 100644 --- a/index.js +++ b/index.js @@ -49,7 +49,7 @@ async function updateReadme(data) { if (todoist.length == 0) return; if (todoist.length > 0) { - console.log(todoist.length); + // console.log(todoist.length); // const showTasks = todoist.reduce((todo, cur, index) => { // return todo + `\n${cur} ` + (((index + 1) === todoist.length) ? '\n' : ''); // })