From 6c71fff2241d11e99fc24d418b810ab43ecafbdc Mon Sep 17 00:00:00 2001 From: Aidan Foster Date: Thu, 1 May 2025 21:50:27 -0700 Subject: [PATCH 1/4] Add actions for syncing submodules --- .../workflows/manual-update-submodules.yml | 53 ++++++++++++++++++ .github/workflows/update-submodules.yml | 56 +++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/workflows/manual-update-submodules.yml create mode 100644 .github/workflows/update-submodules.yml diff --git a/.github/workflows/manual-update-submodules.yml b/.github/workflows/manual-update-submodules.yml new file mode 100644 index 00000000..4d1b7357 --- /dev/null +++ b/.github/workflows/manual-update-submodules.yml @@ -0,0 +1,53 @@ +name: Manual Update Submodules + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to update (leave empty for current branch)' + required: false + default: '' + +jobs: + update-submodules: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: 'recursive' + ref: ${{ github.event.inputs.branch || github.ref }} + + - name: Set up Git + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + + - name: Get current branch + id: branch + run: | + CURRENT_BRANCH=${GITHUB_REF#refs/heads/} + echo "name=$CURRENT_BRANCH" >> $GITHUB_OUTPUT + + - name: Update submodules + run: | + git submodule update --remote --recursive + + - name: Check if submodules changed + id: check_changes + run: | + if [[ -n "$(git status --porcelain)" ]]; then + echo "changes=true" >> $GITHUB_OUTPUT + else + echo "changes=false" >> $GITHUB_OUTPUT + fi + + - name: Commit and push changes + if: steps.check_changes.outputs.changes == 'true' + run: | + git add -A + git commit -m "Update submodules [skip ci]" + git push origin HEAD:${{ steps.branch.outputs.name }} \ No newline at end of file diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml new file mode 100644 index 00000000..97bc7100 --- /dev/null +++ b/.github/workflows/update-submodules.yml @@ -0,0 +1,56 @@ +name: Update Submodules + +on: + schedule: + # Run at 2:00 AM UTC every day + - cron: '0 2 * * *' + workflow_dispatch: # Allow manual trigger + +jobs: + update-submodules: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + # Fetch all history for all branches and tags + fetch-depth: 0 + # Get submodules + submodules: 'recursive' + + - name: Set up Git + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + + - name: Get default branch + id: default_branch + run: | + DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5) + echo "name=$DEFAULT_BRANCH" >> $GITHUB_OUTPUT + + - name: Checkout default branch + run: | + git checkout ${{ steps.default_branch.outputs.name }} + + - name: Update submodules + run: | + git submodule update --remote --recursive + + - name: Check if submodules changed + id: check_changes + run: | + if [[ -n "$(git status --porcelain)" ]]; then + echo "changes=true" >> $GITHUB_OUTPUT + else + echo "changes=false" >> $GITHUB_OUTPUT + fi + + - name: Commit and push changes + if: steps.check_changes.outputs.changes == 'true' + run: | + git add -A + git commit -m "Auto-update submodules [skip ci]" + git push origin ${{ steps.default_branch.outputs.name }} \ No newline at end of file From fb107334b6c9387f8a47aa7b7b056213091154a9 Mon Sep 17 00:00:00 2001 From: Aidan Foster Date: Thu, 1 May 2025 21:55:34 -0700 Subject: [PATCH 2/4] Change auto commit message --- .github/workflows/update-submodules.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 97bc7100..d9970158 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -52,5 +52,5 @@ jobs: if: steps.check_changes.outputs.changes == 'true' run: | git add -A - git commit -m "Auto-update submodules [skip ci]" + git commit -m "Auto-update submodules" git push origin ${{ steps.default_branch.outputs.name }} \ No newline at end of file From dd3181cf132dc49720c45131af0ebec773e95221 Mon Sep 17 00:00:00 2001 From: Aidan Foster Date: Thu, 1 May 2025 21:59:55 -0700 Subject: [PATCH 3/4] Update manual submodule sync --- .github/workflows/manual-update-submodules.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/manual-update-submodules.yml b/.github/workflows/manual-update-submodules.yml index 4d1b7357..30bff74e 100644 --- a/.github/workflows/manual-update-submodules.yml +++ b/.github/workflows/manual-update-submodules.yml @@ -29,8 +29,12 @@ jobs: - name: Get current branch id: branch run: | - CURRENT_BRANCH=${GITHUB_REF#refs/heads/} - echo "name=$CURRENT_BRANCH" >> $GITHUB_OUTPUT + if [[ -n "${{ github.event.inputs.branch }}" ]]; then + echo "name=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT + else + CURRENT_BRANCH=${GITHUB_REF#refs/heads/} + echo "name=$CURRENT_BRANCH" >> $GITHUB_OUTPUT + fi - name: Update submodules run: | From 4197a69a0f5d1b11dcafaba56e27b0f5ab26f030 Mon Sep 17 00:00:00 2001 From: Aidan Foster Date: Thu, 1 May 2025 22:02:51 -0700 Subject: [PATCH 4/4] Delete manual update from testing --- .../workflows/manual-update-submodules.yml | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 .github/workflows/manual-update-submodules.yml diff --git a/.github/workflows/manual-update-submodules.yml b/.github/workflows/manual-update-submodules.yml deleted file mode 100644 index 30bff74e..00000000 --- a/.github/workflows/manual-update-submodules.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Manual Update Submodules - -on: - workflow_dispatch: - inputs: - branch: - description: 'Branch to update (leave empty for current branch)' - required: false - default: '' - -jobs: - update-submodules: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: 'recursive' - ref: ${{ github.event.inputs.branch || github.ref }} - - - name: Set up Git - run: | - git config --global user.name 'github-actions' - git config --global user.email 'github-actions@github.com' - - - name: Get current branch - id: branch - run: | - if [[ -n "${{ github.event.inputs.branch }}" ]]; then - echo "name=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT - else - CURRENT_BRANCH=${GITHUB_REF#refs/heads/} - echo "name=$CURRENT_BRANCH" >> $GITHUB_OUTPUT - fi - - - name: Update submodules - run: | - git submodule update --remote --recursive - - - name: Check if submodules changed - id: check_changes - run: | - if [[ -n "$(git status --porcelain)" ]]; then - echo "changes=true" >> $GITHUB_OUTPUT - else - echo "changes=false" >> $GITHUB_OUTPUT - fi - - - name: Commit and push changes - if: steps.check_changes.outputs.changes == 'true' - run: | - git add -A - git commit -m "Update submodules [skip ci]" - git push origin HEAD:${{ steps.branch.outputs.name }} \ No newline at end of file