You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/classroom.yml
+45-26Lines changed: 45 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -72,14 +72,24 @@ jobs:
72
72
steps:
73
73
- name: Checkout repository
74
74
uses: actions/checkout@v5
75
+
provide_feedback:
76
+
runs-on: ubuntu-latest
77
+
permissions:
78
+
pull-requests: write
79
+
env:
80
+
OPENROUTER_MODEL: ${{ vars.OPENROUTER_MODEL }}
81
+
SYSTEM_PROMPT: ${{ vars.SYSTEM_PROMPT }}
82
+
steps:
83
+
- name: Checkout repository
84
+
uses: actions/checkout@v5
75
85
76
-
# 🧠 Read instructions
77
86
- name: Read assignment instructions
78
87
id: instructions
79
88
run: |
89
+
# Reads the content of the README.md file into an output variable.
90
+
# The `EOF` marker is used to handle multi-line file content.
80
91
echo "instructions=$(cat README.md | sed 's/\"/\\\"/g' | sed 's/$/\\n/' | tr -d '\n' | sed 's/\\n/\\\\n/g')" >> $GITHUB_OUTPUT
81
92
82
-
# 📦 Read source code
83
93
- name: Read source code
84
94
id: source_code
85
95
run: |
@@ -93,7 +103,6 @@ jobs:
93
103
echo 'EOF'
94
104
} >> "$GITHUB_OUTPUT"
95
105
96
-
# 🧪 Read test code
97
106
- name: Read test code
98
107
id: test_code
99
108
run: |
@@ -110,14 +119,10 @@ jobs:
110
119
fi
111
120
echo 'EOF'
112
121
} >> "$GITHUB_OUTPUT"
113
-
114
-
# 🤖 Generate AI Feedback
115
122
- name: Generate AI Feedback
116
123
id: ai_feedback
117
-
env:
118
-
OPENROUTER_MODEL: ${{ vars.OPENROUTER_MODEL }}
119
-
SYSTEM_PROMPT: ${{ vars.SYSTEM_PROMPT }}
120
124
run: |
125
+
# This step sends the collected data to the OpenRouter API.
121
126
INSTRUCTIONS=$(jq -Rs . <<'EOF'
122
127
${{ steps.instructions.outputs.instructions }}
123
128
EOF
@@ -130,30 +135,44 @@ jobs:
130
135
${{ steps.test_code.outputs.test_code }}
131
136
EOF
132
137
)
133
-
138
+
134
139
if [ -z "$INSTRUCTIONS" ] || [ -z "$SOURCE_CODE" ] || [ -z "$TEST_CODE" ]; then
135
140
echo "Error: One or more required variables are not set."
136
-
exit 1
141
+
exit 1
137
142
fi
138
143
139
-
PAYLOAD="Please provide feedback on the following Java assignment.\n\n--- Assignment Instructions ---\n${INSTRUCTIONS}\n\n--- Source files ---\n${SOURCE_CODE}\n\n--- Test files ---\n${TEST_CODE}"
140
-
144
+
# Assigning to USER_CONTENT with variable expansion
145
+
PAYLOAD="Please provide feedback on the following Java assignment.
0 commit comments