-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (40 loc) · 1.54 KB
/
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
# SPDX-FileCopyrightText: 2022 Alec Delaney
#
# SPDX-License-Identifier: MIT
name: Update submodules
on:
repository_dispatch:
types: [update-submodule]
jobs:
update-submodule:
runs-on: ubuntu-latest
steps:
- name: Get and verify update type
run: |
updatetype="${{ github.event.client_payload.type }}"
if [[ $updatetype != "hardware" ]] && [[ $updatetype != "software" ]]
then
echo "Update type must be either 'hardware' or 'software'"
exit 1
fi
- name: Checkout current repo
uses: actions/checkout@v3
with:
submodules: true
- name: Update specified submodule
run: |
git submodule update --remote ${{ github.event.client_payload.type }}
- name: Commit submodule update
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Updating ${{ github.event.client_payload.type }} submodule
branch: submodule-${{ github.event.client_payload.type }}-update-${{ github.event.client_payload.sha }}
create_branch: true
- name: Create pull request
uses: vsoch/pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.HELPER_BOT_TOKEN }}
PULL_REQUEST_BRANCH: "main"
PULL_REQUEST_FROM_BRANCH: submodule-${{ github.event.client_payload.type }}-update-${{ github.event.client_payload.sha }}
PULL_REQUEST_TITLE: Update ${{ github.event.client_payload.type }} module
PULL_REQUEST_BODY: Automatic PR to update the ${{ github.event.client_payload.type }} submodule