Skip to content

Commit 9aef23e

Browse files
Update "create new note" script
1 parent f14406c commit 9aef23e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/create_new_note.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,22 @@ jobs:
1111
- name: Checkout repository
1212
uses: actions/checkout@v2
1313

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
1716
run: |
1817
# Fetch problem details
1918
curl -X POST -H 'Content-Type: application/json' \
2019
-d '{"query":"query questionOfToday { activeDailyCodingChallengeQuestion { date link question { questionId title titleSlug difficulty } } }","operationName":"questionOfToday"}' \
2120
https://leetcode.com/graphql -o response.json
2221
23-
# Parse problem details
22+
# Parse problem details and set outputs
2423
PROBLEM_ID=$(jq -r '.data.activeDailyCodingChallengeQuestion.question.questionId' response.json)
24+
echo "::set-output name=problem_id::${PROBLEM_ID}"
25+
2526
TITLE=$(jq -r '.data.activeDailyCodingChallengeQuestion.question.title' response.json)
2627
TITLE_SLUG=$(jq -r '.data.activeDailyCodingChallengeQuestion.question.titleSlug' response.json)
2728
LINK="https://leetcode.com/problems/${TITLE_SLUG}"
29+
GITHUB_USERNAME="${{ github.actor }}"
2830
2931
# Create problem directory and note
3032
PROBLEM_DIR="problems/${PROBLEM_ID}"
@@ -37,6 +39,6 @@ jobs:
3739
- name: Commit and push changes
3840
uses: stefanzweifel/git-auto-commit-action@v4
3941
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 }}"
4143
branch: main
4244
file_pattern: problems/*/*.md

0 commit comments

Comments
 (0)