Skip to content

Commit bc0a86c

Browse files
committed
Added commands for creating student's submodule
1 parent 830631c commit bc0a86c

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/create-image.yml

+23-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: "initial-image-build-workflow"
33
on:
44
# Trigger a specific workflow run on demand without need for a code push/pull request
55
workflow_dispatch:
6-
# inputs:
7-
# githubRepo:
8-
# description: "Link of public github repo to deploy"
9-
# required: true
6+
inputs:
7+
githubRepo:
8+
description: "Link of public github repo to deploy"
9+
required: true
1010

1111
jobs:
1212
create_docker_image:
@@ -40,4 +40,23 @@ jobs:
4040
fi
4141
cd ./submissions-${year}
4242
43+
- name: Add student's repo as a submodule
44+
- run: |
45+
user_name=username=$(echo "${githubRepo}" | cut -d'/' -f4)
46+
repo_name=$(echo "${githubRepo}" | cut -d'/' -f5)
47+
48+
if [ ! -d ${user_name}-${repo_name} ]; then
49+
echo "Adding the #{githubRepo} to ${user_name}-${repo_name} as a submodule"
50+
51+
git config --global user.name github-actions
52+
git config --global user.email [email protected]
53+
54+
git submodule add ${githubRepo} ${user_name}-${repo_name}
55+
git commit -m "Added ${user_name}-${repo_name} as a submodule by github-actions"
56+
git push
57+
else
58+
echo "Submodule already exists, terminating github actions"
59+
fi
60+
cd ./ ${user_name}-${repo_name}
61+
4362
# need to add export DOCKER_BUILDKIT=1 before building python docker image

0 commit comments

Comments
 (0)