Skip to content

Commit

Permalink
add new result json
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyuanxu-star committed Jul 8, 2024
1 parent 10a2b50 commit 4ec2f6d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,28 @@ jobs:
id: autograding
with:
outputFile: .github/result/check_result.json
- name: Generate summary JSON
run: |
outfile=".github/result/outfile"
summary_file=".github/result/summary.json"
# 提取需要的值
total_exercations=$(jq '.statistics.total_exercations' $outfile)
total_succeeds=$(jq '.statistics.total_succeeds' $outfile)
user_name=$(jq -r '.user_name' $outfile)
# 生成新的 JSON 内容
new_json=$(jq -n \
--arg channel "github" \
--argjson courseId 1558 \
--arg ext "aaa" \
--arg name "$user_name" \
--argjson score "$total_succeeds" \
--argjson totalScore "$total_exercations" \
'{channel: $channel, courseId: $courseId, ext: $ext, name: $name, score: $score, totalScore: $totalScore}')
# 保存新的 JSON 文件
echo "$new_json" > $summary_file
# 打印新的 JSON 文件到终端
cat $summary_file

0 comments on commit 4ec2f6d

Please sign in to comment.