From f7b1c79f5e645ced82bfb5706957b3f6b6759ba8 Mon Sep 17 00:00:00 2001 From: shirosweets Date: Sun, 6 Aug 2023 23:07:43 -0300 Subject: [PATCH 1/2] [Add][Submodule] Famaf-Resources-Manager --- .gitmodules | 3 +++ Famaf-Resources-Manager | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 Famaf-Resources-Manager diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2714552 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Famaf-Resources-Manager"] + path = Famaf-Resources-Manager + url = git@github.com:FAMAF-resources/Famaf-Resources-Manager.git diff --git a/Famaf-Resources-Manager b/Famaf-Resources-Manager new file mode 160000 index 0000000..3fcb92f --- /dev/null +++ b/Famaf-Resources-Manager @@ -0,0 +1 @@ +Subproject commit 3fcb92f8c80d8388e7daf27315d307b0a3ba1157 From 3360f149819f8268c620b3f7573f4542c60005f8 Mon Sep 17 00:00:00 2001 From: shirosweets Date: Sun, 6 Aug 2023 23:08:43 -0300 Subject: [PATCH 2/2] Add update_submodules.yml --- .github/workflows/update_submodules.yml | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/update_submodules.yml diff --git a/.github/workflows/update_submodules.yml b/.github/workflows/update_submodules.yml new file mode 100644 index 0000000..caff858 --- /dev/null +++ b/.github/workflows/update_submodules.yml @@ -0,0 +1,53 @@ +name: 'Update Submodule Action [Child]' +on: + repository_dispatch: + types: [update-submodules-famaf] + schedule: + - cron: '0 0 * * *' + - cron: '0 12 * * *' + # push: + # branches: + # - main + pull_request: + branches: + - main + +env: + SHOULD_COMMIT: '' + +jobs: + famaftestupdate: + name: Update submodules + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.WORKFLOW_TOKEN }} + submodules: recursive + - name: Update submodules + run: git submodule update --init --recursive --checkout -f --remote + + - name: Update status + id: status + run: | + echo $(git status -s) + if [[ $(git status -s) ]]; then + export SHOULD_COMMIT=true + else + export SHOULD_COMMIT=false + fi + echo "SHOULD_COMMIT=$SHOULD_COMMIT" >> $GITHUB_ENV + echo "SHOULD_COMMIT=$SHOULD_COMMIT" + + - name: Config git + if: ${{ env.SHOULD_COMMIT == 'true' }} + run: | + git config --global user.name "GitHub Action" + git config --global user.email "noreply@github.com" + source ./parentRepository/scripts/update_w_from_parent.sh + git add .github + git commit -am "[BOT] Update submodules at $(date "+DATE: %Y-%m-%d TIME: %H:%M:%S")" + git push