Process LeetCode Problems #12
This file contains 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: Process LeetCode Problems | |
on: | |
workflow_run: | |
workflows: ["Sync Leetcode"] | |
types: | |
- completed | |
permissions: | |
contents: write | |
jobs: | |
process: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ github.token }} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Create problems directory | |
run: mkdir -p problems | |
- name: Process problems | |
run: go run scripts/process_problems.go | |
- name: Rename problems in 0 directory | |
run: go run leetcode-db/cmd/populate-db/main.go | |
- name: Commit directory changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add problems/ | |
git add -u # This will stage deletions of the old directories | |
git commit -m "Move and rename problems" || echo "No changes to commit" | |
git push |