From cc5caee7b0c002b2719a7f5012476464072aa2b0 Mon Sep 17 00:00:00 2001 From: Preetham Pemmasani <75422607+ppmpreetham@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:44:24 +0530 Subject: [PATCH 1/2] help with read and write permissions --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cbaf39ff..926bd922 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ GitHub Action for automatically syncing LeetCode submissions to a GitHub reposit commit-header: "[LeetCode Sync]" ``` +6. Go to your repository's `Settings` tab, and in the left sidebar, click Actions, then click General. Under `Workflow permissions`, change to `Read and Write permissions` 6. After you've submitted a LeetCode solution, run the workflow by going to the `Actions` tab, clicking the action name, e.g. `Sync Leetcode`, and then clicking `Run workflow`. The workflow will also automatically run once a week by default (can be configured via the `cron` parameter). ## Inputs From b5d5227f8be53e87092996c4567455760a38ea05 Mon Sep 17 00:00:00 2001 From: Preetham Pemmasani <75422607+ppmpreetham@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:13:29 +0530 Subject: [PATCH 2/2] A better way to get the cookies --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 926bd922..dfe84f62 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,21 @@ GitHub Action for automatically syncing LeetCode submissions to a GitHub reposit - Look for a network request to https://leetcode.com. - Look under `Request Headers` for the `cookie:` attribute to find the values. -2. Create a new GitHub repository to host the LeetCode submissions. + (or) + - After logging in, right-click on the page and press `Inspect`. + - Go to `Application Tab > Storage > Cookies` + - Look for `http://leetcode.com` and get `cfsrtoken` and `SESSION_TOKEN` + +3. Create a new GitHub repository to host the LeetCode submissions. - It can be either private or public. -3. Add the values from step 1 as [GitHub secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository), +4. Add the values from step 1 as [GitHub secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository), e.g. `LEETCODE_CSRF_TOKEN` and `LEETCODE_SESSION`. -4. Go to REPO > settings > actions and in Workflow Permissions section give actions Read and Write permissions. +5. Go to `REPO Settings > Actions`. In Workflow Permissions section, give actions Read and Write permissions. -5. Add a workflow file with this action under the `.github/workflows` directory, e.g. `sync_leetcode.yml`. +6. Add a workflow file with this action under the `.github/workflows` directory, e.g. `sync_leetcode.yml`. Example workflow file: @@ -58,7 +63,7 @@ GitHub Action for automatically syncing LeetCode submissions to a GitHub reposit commit-header: "[LeetCode Sync]" ``` -6. Go to your repository's `Settings` tab, and in the left sidebar, click Actions, then click General. Under `Workflow permissions`, change to `Read and Write permissions` +7. Go to your repository's `Settings` tab, and in the left sidebar, click Actions, then click General. Under `Workflow permissions`, change to `Read and Write permissions` 6. After you've submitted a LeetCode solution, run the workflow by going to the `Actions` tab, clicking the action name, e.g. `Sync Leetcode`, and then clicking `Run workflow`. The workflow will also automatically run once a week by default (can be configured via the `cron` parameter). ## Inputs