-
Notifications
You must be signed in to change notification settings - Fork 66
Updated action.js to Handle Locked LeetCode Premium Problems and Improve Sync Reliability #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added error handling in the `getInfo` function to skip locked problems. When the function encounters a locked problem (HTTP 403 error), it logs a message and skips the problem instead of retrying or throwing an exception. - Updated the `getQuestionData` function to handle locked problems. If fetching the question data results in a locked problem error (HTTP 403), it logs the error and returns null to indicate that the problem should be skipped. Modified the `sync` function to skip submissions related to locked problems. It continues the sync process for other problems, ensuring that locked problems do not cause the entire sync process to fail.
…f the leetcode-sync GitHub Action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvement, really appreciate it!
src/action.js
Outdated
@@ -415,13 +425,22 @@ async function sync(inputs) { | |||
leetcodeSession, | |||
leetcodeCSRFToken, | |||
); | |||
if (!submission) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also do "submission === null" here to be consistent with L440?
README.md
Outdated
@@ -48,7 +48,7 @@ GitHub Action for automatically syncing LeetCode submissions to a GitHub reposit | |||
|
|||
steps: | |||
- name: Sync | |||
uses: joshcai/leetcode-sync@v1.6 | |||
uses: AlyHG/leetcode-sync@master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you revert this line? I'll create a new release after this is in, and bump the version number up.
README.md
Outdated
@@ -111,3 +111,17 @@ Special thanks to the following people who helped beta test this GitHub Action a | |||
- [uakfdotb](https://github.com/uakfdotb) | |||
- [hexecute](https://github.com/hexecute) | |||
- [JonathanZhu11](https://github.com/JonathanZhu11) | |||
|
|||
## Updated by [Aly Ghallab](https://github.com/AlyHG) to Handle Locked LeetCode Premium Problems and Improve Sync Reliability - June 19, 2024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be okay if I add this info in the release notes section when creating a new release? e.g. similar to https://github.com/joshcai/leetcode-sync/releases/tag/v1.6
…for merge - Changed condition to "submission === null" in src/action.js for syntax consistency. - Reverted "uses" line in README.md to point back to joshcai/[email protected]. - Removed self-crediting section from README.md. Agreed to include this information in the release notes instead.
Hey, I applied your feedback and made the changes requested. Let me know if there's anything else. |
Thanks! Looks good to me now - merging. |
Description:
This pull request addresses an issue where users with previously unlocked LeetCode premium problems would experience failures during the sync process. The following changes have been made:
getInfo
function to skip locked problems. When the function encounters a locked problem (HTTP 403 error), it logs a message and skips the problem instead of retrying or throwing an exception.getQuestionData
function to handle errors when fetching question data for locked problems. If fetching the question data results in a locked problem error (HTTP 403), it logs the error and returns null to indicate that the problem should be skipped.sync
function to continue syncing other problems even if some are locked, ensuring that locked problems do not cause the entire sync process to fail.These changes improve the sync process by handling scenarios where some LeetCode problems are locked, allowing the action to continue syncing all available, unlocked problems successfully.