From fc786443dbfbb402c974a93d835707f3ab9bebfa Mon Sep 17 00:00:00 2001 From: Menna Tullah Magdy Taha Date: Tue, 23 Apr 2024 15:36:07 +0200 Subject: [PATCH] Added command to check for dependency --- .github/workflows/create-image.yml | 49 ++++++++++++++----- .gitmodules | 9 ---- .../lillywallawitsch-Wondernest.Express | 1 - submissions-2024/maggieekubat-Recipe | 1 - 4 files changed, 37 insertions(+), 23 deletions(-) delete mode 100644 .gitmodules delete mode 160000 submissions-2024/lillywallawitsch-Wondernest.Express delete mode 160000 submissions-2024/maggieekubat-Recipe diff --git a/.github/workflows/create-image.yml b/.github/workflows/create-image.yml index 5c4dfb4..492eefa 100644 --- a/.github/workflows/create-image.yml +++ b/.github/workflows/create-image.yml @@ -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: @@ -22,14 +24,7 @@ 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') @@ -37,17 +32,47 @@ jobs: 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 github-actions@github.com - 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 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 7556e7b..0000000 --- a/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "lillywallawitsch-Wondernest.Express"] - path = lillywallawitsch-Wondernest.Express - url = https://github.com/lillywallawitsch/Wondernest.Express -[submodule "submissions-2024/maggieekubat-Recipe"] - path = submissions-2024/maggieekubat-Recipe - url = https://github.com/maggieekubat/Recipe -[submodule "submissions-2024/lillywallawitsch-Wondernest.Express"] - path = submissions-2024/lillywallawitsch-Wondernest.Express - url = https://github.com/lillywallawitsch/Wondernest.Express diff --git a/submissions-2024/lillywallawitsch-Wondernest.Express b/submissions-2024/lillywallawitsch-Wondernest.Express deleted file mode 160000 index 837425e..0000000 --- a/submissions-2024/lillywallawitsch-Wondernest.Express +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 837425e2d6cc3966a7212cddbb91cfdf5c7b6eac diff --git a/submissions-2024/maggieekubat-Recipe b/submissions-2024/maggieekubat-Recipe deleted file mode 160000 index a4c63aa..0000000 --- a/submissions-2024/maggieekubat-Recipe +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a4c63aa3a477f8155baefd3b2758ab58865e5faf