Skip to content

Commit 4d31d46

Browse files
committed
Add GitHub Action to sync submodules to classroom repos
Syncs the 6 assignment template repos to their GitHub Classroom counterparts: - eliza-llm-course → models-of-language-and-conversation-eliza-chatbot-eliza-llm-course - spam-classifier-llm-course → models-of-language-and-conversation-spam-classifier-spam-classifier-llm-course - embeddings-llm-course → models-of-language-and-conversation-wikipedia-embeddings-embeddings-llm-course - customer-service-bot-llm-course → models-of-language-and-conversation-customer-service-chatbot-customer-service-bot-llm-course - gpt-llm-course → models-of-language-and-conversation-built-gpt-gpt-llm-course - final-project-llm-course → models-of-language-and-conversation-final-project-final-project-llm-course Requires CLASSROOM_SYNC_TOKEN secret with repo access to the private classroom repos.
1 parent a5b84be commit 4d31d46

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Sync to GitHub Classroom
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'assignments/**-llm-course/**'
8+
workflow_run:
9+
workflows: ["Build Course Pages"]
10+
types: [completed]
11+
branches: [main]
12+
workflow_dispatch:
13+
14+
jobs:
15+
sync:
16+
runs-on: ubuntu-latest
17+
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
18+
strategy:
19+
matrix:
20+
include:
21+
- submodule: eliza-llm-course
22+
classroom: models-of-language-and-conversation-eliza-chatbot-eliza-llm-course
23+
- submodule: spam-classifier-llm-course
24+
classroom: models-of-language-and-conversation-spam-classifier-spam-classifier-llm-course
25+
- submodule: embeddings-llm-course
26+
classroom: models-of-language-and-conversation-wikipedia-embeddings-embeddings-llm-course
27+
- submodule: customer-service-bot-llm-course
28+
classroom: models-of-language-and-conversation-customer-service-chatbot-customer-service-bot-llm-course
29+
- submodule: gpt-llm-course
30+
classroom: models-of-language-and-conversation-built-gpt-gpt-llm-course
31+
- submodule: final-project-llm-course
32+
classroom: models-of-language-and-conversation-final-project-final-project-llm-course
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: recursive
39+
fetch-depth: 0
40+
41+
- name: Check token exists
42+
run: |
43+
if [ -z "${{ secrets.CLASSROOM_SYNC_TOKEN }}" ]; then
44+
echo "::error::CLASSROOM_SYNC_TOKEN secret is not set"
45+
exit 1
46+
fi
47+
48+
- name: Sync ${{ matrix.submodule }} to classroom
49+
env:
50+
GH_TOKEN: ${{ secrets.CLASSROOM_SYNC_TOKEN }}
51+
run: |
52+
cd assignments/${{ matrix.submodule }}
53+
54+
git config user.name "github-actions[bot]"
55+
git config user.email "github-actions[bot]@users.noreply.github.com"
56+
57+
CLASSROOM_URL="https://x-access-token:${GH_TOKEN}@github.com/ContextLab/${{ matrix.classroom }}.git"
58+
git remote add classroom "$CLASSROOM_URL" 2>/dev/null || git remote set-url classroom "$CLASSROOM_URL"
59+
60+
echo "Pushing ${{ matrix.submodule }} to ContextLab/${{ matrix.classroom }}..."
61+
if git push classroom HEAD:main --force; then
62+
echo "::notice::Successfully synced ${{ matrix.submodule }}"
63+
else
64+
echo "::error::Failed to sync ${{ matrix.submodule }}"
65+
exit 1
66+
fi

0 commit comments

Comments
 (0)