joshcai / leetcode-sync

GitHub Action for syncing LeetCode submissions to GitHub
303 stars 61 forks source link

HttpError: tree.path contains a malformed path component #22

Closed wmorgue closed 7 months ago

wmorgue commented 2 years ago

Hi Josh 🤝 Trying to configure and run a workflow, but I get this error:

Sync Leetcode · wmorgueleetcode-swift-solution@f641ca5

2022-09-14T08:08:28.0241799Z Download action repository 'joshcai/leetcode-sync@v1.4' (SHA:2016e49c7853566842db62462b1e52e8c301cbe2)
2022-09-14T08:08:29.7598717Z ##[group]Run joshcai/leetcode-sync@v1.4
2022-09-14T08:08:29.7599196Z with:
2022-09-14T08:08:29.7599817Z   github-token: ***
2022-09-14T08:08:29.7600424Z   leetcode-csrf-token: ***
2022-09-14T08:08:29.7616341Z   leetcode-session: ***
2022-09-14T08:08:29.7616747Z   destination-folder: src/
2022-09-14T08:08:29.7617127Z   filter-duplicate-secs: 86400
2022-09-14T08:08:29.7617430Z ##[endgroup]
2022-09-14T08:08:30.5020860Z [Wed, 14 Sep 2022 08:08:30 GMT] Getting submission from LeetCode, offset 0
2022-09-14T08:08:30.8912716Z [Wed, 14 Sep 2022 08:08:30 GMT] Getting submission from LeetCode, offset 20
2022-09-14T08:08:32.4256574Z [Wed, 14 Sep 2022 08:08:32 GMT] Default branch for wmorgue/leetcode-swift-solution: main
2022-09-14T08:08:32.4257183Z [Wed, 14 Sep 2022 08:08:32 GMT] Syncing 5 submissions...
2022-09-14T08:08:32.4257542Z [Wed, 14 Sep 2022 08:08:32 GMT] Committing solution for fizz_buzz...
2022-09-14T08:08:32.8695884Z [Wed, 14 Sep 2022 08:08:32 GMT] HttpError: tree.path contains a malformed path component
2022-09-14T08:08:32.8696886Z     at /home/runner/work/_actions/joshcai/leetcode-sync/v1.4/node_modules/@octokit/request/dist-node/index.js:66:23
2022-09-14T08:08:32.8697535Z     at processTicksAndRejections (internal/process/task_queues.js:97:5)
2022-09-14T08:08:32.8698540Z     at async commit (/home/runner/work/_actions/joshcai/leetcode-sync/v1.4/index.js:70:24)
2022-09-14T08:08:32.8699838Z     at async sync (/home/runner/work/_actions/joshcai/leetcode-sync/v1.4/index.js:241:34)
2022-09-14T08:08:32.8700766Z     at async main (/home/runner/work/_actions/joshcai/leetcode-sync/v1.4/index.js:255:3)
2022-09-14T08:08:32.8762453Z ##[error]HttpError: tree.path contains a malformed path component

sync_leetcode.yml:


name: Sync Leetcode

on:
  workflow_dispatch:
  schedule:
    - cron:  '0 9 * * *'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Sync
      uses: joshcai/leetcode-sync@v1.4
      with:
        github-token: ${{ github.token }}
        leetcode-csrf-token: ${{ secrets.LEETCODE_CSRF_TOKEN }}
        leetcode-session: ${{ secrets.LEETCODE_SESSION }}
        destination-folder: src/
wmorgue commented 2 years ago

P.S. Repos is private.

joshcai commented 2 years ago

Hi @wmorgue, could you try changing the destination-folder value to just src without the trailing /? I think it might be causing the invalid path. If that helps I can update the code to strip trailing suffixes by default to prevent users from running into this in the future.

wmorgue commented 2 years ago

@joshcai Great news! It works. Just change destination-folder from src/ to src and sync complete 🤝 Thank you.

Sync Leetcode · wmorgueleetcode-swift-solution@1108785