Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
uses: openMF/mifos-mobile-github-actions/.github/workflows/build-and-deploy-site.yaml@main
secrets: inherit
with:
web_package_name: 'mifos-web' # <-- Change with your web package name
web_package_name: 'cmp-web' # <-- Change with your web package name
101 changes: 101 additions & 0 deletions .github/workflows/sync-cmp-dirs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Sync CMP Directories
on:
# Manual trigger
workflow_dispatch:
# Run weekly on Monday at 00:00 UTC
schedule:
- cron: '0 0 * * 1'

jobs:
sync-directories:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Git config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Add upstream remote
run: |
git remote add upstream https://github.com/openMF/kmp-project-template.git || true
git fetch upstream

- name: Create temporary branch
run: |
TEMP_BRANCH="temp-sync-branch-${{ github.run_number }}"
git checkout -b $TEMP_BRANCH upstream/dev

- name: Sync CMP directories
run: |
DIRS=("cmp-android" "cmp-desktop" "cmp-ios" "cmp-web")
git checkout dev
for dir in "${DIRS[@]}"; do
if [ -d "$dir" ]; then
echo "Syncing $dir..."
else
echo "Creating $dir..."
mkdir -p "$dir"
fi
git checkout temp-sync-branch-${{ github.run_number }} -- "$dir"
done

- name: Clean up temporary branch
run: |
git branch -D temp-sync-branch-${{ github.run_number }}

- name: Check for changes
id: check_changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "Has changes to commit"
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit"
echo "has_changes=false" >> $GITHUB_OUTPUT
fi

- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git add cmp-android cmp-desktop cmp-ios cmp-web
git commit -m "chore: Sync CMP directories from upstream

Automated sync of CMP directories:
- cmp-android
- cmp-desktop
- cmp-ios
- cmp-web

Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

git push origin dev

- name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
title: "chore: Sync CMP directories from upstream"
body: |
Automated sync of CMP directories from upstream repository.

Changes included in this sync:
- cmp-android
- cmp-desktop
- cmp-ios
- cmp-web

Please review the changes and merge if everything looks correct.

Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
branch: sync-cmp-dirs
commit-message: "chore: Sync CMP directories from upstream"
delete-branch: true
labels: |
sync
automated pr
Loading