Skip to content

dos-m0nk3y/LeetCode-Synchronizer

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Synchronizer

LeetCode Synchronizer is a GitHub Action that automatically collects and organizes LeetCode submissions into a GitHub repository.

Here's a sample repository created using LeetCode Synchronizer: leetcode-synchronizer-sample

Features

  • Fully automated collection of all your latest accepted submissions with minimal effort setup
  • Single commit for each submission stamped with the original submission date for building rich and accurate contributions graph
  • Automated git pushes to the remote repository with every action triggers
  • Auto-generate README.md based on retrieved submissions

Setup

  1. Retrieve LeetCode cookies

    • Login to LeetCode
    • Open Web Developer Tools
    • Find https://leetcode.com from Storage > Cookies
    • Copy values for cookies LEETCODE_SESSION and csrftoken
  2. Create a GitHub repository for LeetCode synchronization

  3. Create GitHub Secrets for LeetCode API access

    • Open Settings > Secrets and variables > Actions from the repository
    • Click New repository secret
    • Create a new secret LEETCODE_SESSION using LEETCODE_SESSION cookie value
    • Create a new secret LEETCODE_CSRF_TOKEN using csrftoken cookie value
  4. Give workflows write permissions in the repository for git pushes

    • Open Settings > Actions > General from the repository
    • Select Read and write permissions from Workflow permissions and save
  5. Create GithHub Action

    • Create a workflow directory .github/workflows/

    • Create a workflow file, e.g., leetcode_synchronizer.yml

    • Copy the following YAML contents into the leetcode_synchronizer.yml file:

      name: LeetCode Synchronizer
      on: workflow_dispatch
      jobs:
        build:
          runs-on: ubuntu-latest
          steps:
            - name: Run LeetCode Synchronizer
              uses: dos-m0nk3y/LeetCode-Synchronizer@v1.1.0
              with:
                GITHUB_TOKEN: ${{ github.token }}
                LEETCODE_SESSION: ${{ secrets.LEETCODE_SESSION }}
                LEETCODE_CSRF_TOKEN: ${{ secrets.LEETCODE_CSRF_TOKEN }}
  6. Trigger GitHub action

    • Open Actions > LeetCode Synchronizer from the repository
    • Click Run workflow > Run workflow

Inputs

  • GITHUB_TOKEN - required. GitHub token used in pushing submissions to the repository
  • LEETCODE_SESSION - required. LeetCode session used in accessing LeetCode API
  • LEETCODE_CSRF_TOKEN - required. LeetCode CSRF token used in accessing LeetCode API

About

GitHub Action for synchronizing LeetCode and GitHub

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages