Skip to content

ngshiheng/todoleet

Repository files navigation

TodoLeet

Syncs Daily LeetCoding Challenge to Todoist.

CI Release

Table of Contents

Context

graph LR;
    A[Schedule Event] --> B[Sync LeetCode Coding Challenge];
    B --> C{Fetch Daily Coding Challenge};
    C -->|Success| D[Create Todoist Task];
    C -->|Failure| E[Handle Error];
    D --> F[Task Created];
    E --> G[Error Handling];

A Cloudflare Worker project that syncs Daily LeetCoding Challenge to your Todoist. The worker runs every day at 00:01 UTC and syncs the Daily LeetCoding Challenge to your Todoist.

Read more....

Requirements

  • A Cloudflare account
  • Install Wrangler CLI for Cloudflare Workers deployment

Installation

The dependencies are only used for development. So the installation is not required.

npm ci

Usage

To test out the cron trigger locally, run the following:

# 1. set TODOIST_API_TOKEN
wrangler login
wrangler secret put TODOIST_API_TOKEN

# 2. run worker
npm run dev # wrangler dev --test-scheduled --remote

# 3. test scheduled event.
curl "http://localhost:8787/__scheduled"

# 4. check if a new task is created on your Todoist

Deployment

Wrangler CLI

  1. Add TODOIST_API_TOKEN using wrangler secret put TODOIST_API_TOKEN. You may find the newly added secret under Cloudflare Worker -> Settings -> Variables. You can get your Todoist API token from https://app.todoist.com/app/settings/integrations/developer.

  2. This is only required for Wrangler actions. Add CF_API_TOKEN into your GitHub repository secrets. You can create your API token from https://dash.cloudflare.com/profile/api-tokens using the Edit Cloudflare Workers template.

  3. To publish any new changes to your Cloudflare Worker, run wrangler deploy

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork this
  2. Create your feature branch (git checkout -b tommy/fooBar)
  3. Commit your changes (git commit -am 'feat: add some fooBar', make sure that your commits are semantic)
  4. Push to the branch (git push origin tommy/fooBar)
  5. Create a new Pull Request

References

FAQ

Is it safe to publish wrangler.toml with account_id?

Yes.