Sync LeetCode Solutions #438
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync LeetCode Solutions | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 12 * * *" # Runs daily at 12:00 UTC | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync-leetcode: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| # STEP 1: Calculate the PST/PDT timestamp with the correct offset | |
| - name: Compute PST Timestamp | |
| id: tz | |
| run: | | |
| # This generates a string like 2023-10-27T16:00:00-0700 | |
| ts="$(TZ='America/Los_Angeles' date +%Y-%m-%dT%H:%M:%S%z)" | |
| echo "current_time=$ts" >> $GITHUB_OUTPUT | |
| # STEP 2: Pass those timestamps as environment variables to the sync tool | |
| - name: Sync LeetCode Solutions | |
| uses: joshcai/leetcode-sync@v1.7 | |
| env: | |
| GIT_AUTHOR_DATE: ${{ steps.tz.outputs.current_time }} | |
| GIT_COMMITTER_DATE: ${{ steps.tz.outputs.current_time }} | |
| with: | |
| github-token: ${{ github.token }} | |
| leetcode-csrf-token: ${{ secrets.LEETCODE_CSRF_TOKEN }} | |
| leetcode-session: ${{ secrets.LEETCODE_SESSION }} | |
| destination-folder: leetcode-solutions | |
| verbose: true | |
| commit-header: "[LeetCode Sync]" | |
| filter-duplicate-secs: 86400 |