-
Notifications
You must be signed in to change notification settings - Fork 635
45 lines (43 loc) · 1.55 KB
/
update-submodules.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
45
name: Update Library Submodules
on:
workflow_dispatch:
inputs:
branch:
description: 'Target branch for raising PR'
required: true
default: main
allowed:
description: 'Optional regex pattern passed to `grep` to update only the specified library submodules, e.g. "jobs" updates only libraries with "jobs" in the name.'
required: false
default: .*
jobs:
update-submodules:
name: Update submodules
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- name: Configure Git identity
run: |
git config --global user.name "Submodule Updater"
- name: Update the submodules
env:
ALLOWED: ${{ github.event.inputs.allowed }}
run: |
libs=$(find libraries/standard libraries/aws -maxdepth 1 -mindepth 1 | grep "$ALLOWED")
git submodule update --remote $libs
- name: Commit changes and Push to remote
run: |
now="$(date +'%d-%m-%Y')"
branch="updater-job/submodules-$now"
git checkout -b $branch
git commit -am 'Updating library submodules to the latest.'
git push --set-upstream origin $branch
- name: Raise a Pull-Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ github.event.inputs.branch }}
run: |
gh pr create --base "$BRANCH" --title 'Update library submodules to the latest' --body 'Update library submodules to the latest'