-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (38 loc) · 1.16 KB
/
submodule-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Update Submodules
on:
workflow_dispatch:
inputs:
title:
description: 'Title for the workflow run'
required: true
default: 'Triggered by API'
jobs:
update-submodules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive # Initialize and fetch all submodules
- name: Update submodules to latest commit
run: |
git submodule update --remote
- name: Check for changes
id: changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changes=true" >> $GITHUB_ENV
else
echo "changes=false" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.changes == 'true'
run: |
git config user.name 'NSPBot911'
git config user.email ${{ secrets.BOT_EMAIL }}
git add --all
git commit -m "Updated submodules" -m "Triggered by ${{ github.event.inputs.title }}"
git pull origin main
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}