Skip to content

Commit efd5e49

Browse files
authored
Merge pull request #4 from akgohain/main
submodule tweaks
2 parents 23727fa + 2cc0b05 commit efd5e49

4 files changed

Lines changed: 57 additions & 3 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Update Submodules
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
update-submodules:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: 'recursive'
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Configure Git
23+
run: |
24+
git config --global user.name "github-actions[bot]"
25+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
26+
27+
- name: Update submodules to their latest default branch
28+
run: |
29+
echo "Updating submodules..."
30+
git submodule foreach --recursive '
31+
git fetch origin
32+
if git rev-parse --verify origin/main > /dev/null 2>&1; then
33+
echo "Switching $name ($path) to origin/main"
34+
git checkout origin/main
35+
elif git rev-parse --verify origin/master > /dev/null 2>&1; then
36+
echo "Switching $name ($path) to origin/master"
37+
git checkout origin/master
38+
else
39+
echo "Could not find main or master branch for $name ($path). Submodule not updated."
40+
fi
41+
'
42+
echo "Submodule update process complete."
43+
44+
- name: Commit and push submodule updates
45+
run: |
46+
git add .
47+
if git diff --staged --quiet; then
48+
echo "No submodule changes to commit."
49+
else
50+
echo "Committing submodule updates..."
51+
git commit -m "ci: Update submodules to latest default branch (main/master)"
52+
echo "Pushing changes..."
53+
git push
54+
fi

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "hydra"]
22
path = ves_unsup
3-
url = git@github.com:jasonkena/hydra.git
3+
url = https://github.com/jasonkena/hydra.git
44
[submodule "ves_analysis"]
55
path = ves_analysis
66
url = https://github.com/gnuoyea/hydra_micaela.git

ves_unsup

Submodule ves_unsup updated 1 file

0 commit comments

Comments
 (0)