Get Daily LeetCode Problem is a node.js script that will get the daily problem from LeetCode and create a markdown file with the problem description and the link to the problem.
Also, it will create a folder with the name of the problem and a file with the solution template.
- Create a
.github\workflowsfolder in your repository.
./project root
└── .github
└── workflows- Create a
daily-leetcode-problem.ymlfile in the.github\workflowsfolder.
./project root
└── .github
└── workflows
└── daily-leetcode-problem.yml- Copy the following code into the
daily-leetcode-problem.ymlfile.
name: Get Daily LeetCode Problem
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch: # Manually trigger the workflow - 🔮 you can remove this line
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }} # If you are using a private repository
- name: Get Daily LeetCode Problem
uses: RndmCodeGuy20/Daily-LC-Problem-Action@v2.0.0 # Use the latest version - ✨ - if you are reading this care to checkout the marketplace for the latest version
with:
lang_choice: "Python3"
# Strictly use one of these options : ["C++", "C", "Python3", "JavaScript", "Java"] - 🚀 names are case sensitive
- name: Commit and push changes
run: |
git config --global user.name 'author name' # Replace with your name
git config --global user.email 'author email' # Replace with your email
git status
git add .
git commit -m "chore(action): today's daily leetcode question added"
git push-
Run the workflow manually or wait for the scheduled time.
-
The workflow will create a folder with the name of the problem and a file with the solution template.