Skip to content

Commit

Permalink
Added command to check for dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
alkaline-0 committed Apr 23, 2024
1 parent 847b0c2 commit fc78644
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
49 changes: 37 additions & 12 deletions .github/workflows/create-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
required: true

jobs:
create_docker_image:
create_submodule:
permissions:
contents: "write"
outputs:
status: ${{ steps.create_student_submodule.outcome }}

runs-on: ubuntu-latest
defaults:
Expand All @@ -22,32 +24,55 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Github dependents info
run: pip install -U github-dependents-info

- id: create_student_submodule
- name: Add student's repo as a submodule
run: |
year=$(date '+%Y')
user_name=$(echo "${{ github.event.inputs.githubRepo }}" | cut -d'/' -f4)
repo_name=$(echo "${{ github.event.inputs.githubRepo }}" | cut -d'/' -f5)
if [ ! -d submissions-${year}/${user_name}-${repo_name} ]; then
echo "Adding ${{ github.event.inputs.githubRepo }} to ./submissions-${year}/${user_name}-${repo_name} as a submodule"
echo "Adding ${{ github.event.inputs.githubRepo }} to ./submissions-${year}/${user_name}-${repo_name}/${user_name}-${repo_name} as a submodule"
git config --global user.name github-actions
git config --global user.email [email protected]
git submodule add ${{ github.event.inputs.githubRepo }} ./submissions-${year}/${user_name}-${repo_name}
git submodule add ${{ github.event.inputs.githubRepo }} ./submissions-${year}/${user_name}-${repo_name}/${user_name}-${repo_name}
git commit -m "Added ${user_name}-${repo_name} as a submodule by github-actions"
git push
else
echo "Submodule already exists, terminating github actions"
fi
cd ./submissions-${year}/${user_name}-${repo_name}
cd ./submissions-${year}/${user_name}-${repo_name}/
create_docker_image:
permissions:
contents: "write"
needs: create_submodule
runs-on: ubuntu-latest
defaults:
run:
shell: bash

if: needs.create_submodule.outputs.status == "success"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Github dependents info
run: pip install -U github-dependents-info

- name: Get submodule's dependencies in JSON file
run: github-dependents-info --repo ${user_name}/${repo_name} --json

- name: Check if the JSON file was created successfully
run: |
if [[ -f ${user_name}/${repo_name}.json ]]; then
echo "${user_name}/${repo_name}.json exists!"
else
echo "${user_name}/${repo_name}.json does not exist!"
fi
# need to add export DOCKER_BUILDKIT=1 before building python docker image
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion submissions-2024/lillywallawitsch-Wondernest.Express
Submodule lillywallawitsch-Wondernest.Express deleted from 837425
1 change: 0 additions & 1 deletion submissions-2024/maggieekubat-Recipe
Submodule maggieekubat-Recipe deleted from a4c63a

0 comments on commit fc78644

Please sign in to comment.