@@ -11,20 +11,22 @@ jobs:
11
11
- name : Checkout repository
12
12
uses : actions/checkout@v2
13
13
14
- - name : Fetch daily LeetCode problem details and create note
15
- env :
16
- GITHUB_USERNAME : ${{ github.actor }}
14
+ - name : Fetch daily LeetCode problem details
15
+ id : fetch_problem
17
16
run : |
18
17
# Fetch problem details
19
18
curl -X POST -H 'Content-Type: application/json' \
20
19
-d '{"query":"query questionOfToday { activeDailyCodingChallengeQuestion { date link question { questionId title titleSlug difficulty } } }","operationName":"questionOfToday"}' \
21
20
https://leetcode.com/graphql -o response.json
22
21
23
- # Parse problem details
22
+ # Parse problem details and set outputs
24
23
PROBLEM_ID=$(jq -r '.data.activeDailyCodingChallengeQuestion.question.questionId' response.json)
24
+ echo "::set-output name=problem_id::${PROBLEM_ID}"
25
+
25
26
TITLE=$(jq -r '.data.activeDailyCodingChallengeQuestion.question.title' response.json)
26
27
TITLE_SLUG=$(jq -r '.data.activeDailyCodingChallengeQuestion.question.titleSlug' response.json)
27
28
LINK="https://leetcode.com/problems/${TITLE_SLUG}"
29
+ GITHUB_USERNAME="${{ github.actor }}"
28
30
29
31
# Create problem directory and note
30
32
PROBLEM_DIR="problems/${PROBLEM_ID}"
37
39
- name : Commit and push changes
38
40
uses : stefanzweifel/git-auto-commit-action@v4
39
41
with :
40
- commit_message : " Creating a template for ${{ github.actor }}'s solution to problem ${PROBLEM_ID }"
42
+ commit_message : " Creating a template for ${{ github.actor }}'s solution to problem ${{ steps.fetch_problem.outputs.problem_id } }"
41
43
branch : main
42
44
file_pattern : problems/*/*.md
0 commit comments