-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (48 loc) · 2.06 KB
/
sync-rovecomm.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Sync RoveComm Submodule
on:
# Triggered from a webhook sent by a push to https://github.com/missourimrdt/rovecomm_base via an implementation of https://github.com/Byrdman32/github-action-on-webhook
repository_dispatch:
types: [rovecomm_sync]
permissions:
contents: write
pull-requests: write
jobs:
checkout_rovecomm_submodule:
runs-on: ubuntu-latest
steps:
- name: Checkout main repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up GitHub CLI
run: |
sudo apt-get install -y gh
echo "${{ secrets.PAT_TOKEN }}" | gh auth login --with-token
gh auth setup-git # Ensure gh is authenticated with GITHUB_TOKEN
- name: Update RoveComm submodule to latest commit
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Fetch and update the submodule to the latest commit from the remote branch
git submodule update --remote -- Sources/RoveComm_Swift/Resources/Manifest
# Ensure Git detects the submodule change by explicitly adding the submodule state
git add Sources/RoveComm_Swift/Resources/Manifest
# Check for any changes
git status
git diff --cached
# Commit any changes
if git diff-index --quiet HEAD; then
echo "No changes to commit"
else
git commit -m "Update RoveComm submodule to the latest commit"
git status
BRANCH_NAME="sync/rovecomm-$(date +'%Y%m%d-%H%M%S')"
git checkout -b $BRANCH_NAME
git push origin $BRANCH_NAME
git status
gh pr create --head $BRANCH_NAME --base development \
--title "Update RoveComm submodule to the latest commit" \
--body "This pull request updates the RoveComm submodule to the latest commit." \
--reviewer "MissouriMRDT/rovecomm-review"
fi