Skip to content

Commit

Permalink
Merge pull request #2 from MissouriMRDT/topic/rovecomm-sync
Browse files Browse the repository at this point in the history
Add Automation to RoveComm Manifest Updates
  • Loading branch information
Byrdman32 authored Oct 14, 2024
2 parents 76b4c07 + d7d9ac0 commit c8cd868
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/sync-rovecomm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit c8cd868

Please sign in to comment.