Skip to content

Commit

Permalink
Sync Homepage Daily on cron
Browse files Browse the repository at this point in the history
  • Loading branch information
djeinstine committed Nov 21, 2024
1 parent 48fa727 commit 8942ce8
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 76 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/sync-dev-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Sync Homepage Daily

on:
schedule:
- cron: '50 22 * * *'
# push:
# branches:
# - private

env:
REMOTE_URL: https://github.com/gethomepage/homepage.git
REPO_NAME: upstream
SYNC_BRANCH: dev
MERGE_BRANCH: integration

jobs:
sync-dev-branch:
name: Sync Dev Branch
runs-on: ubuntu-22.04

steps:
- name: Checkout my repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
token: ${{ github.token }}
ref: ${{env.SYNC_BRANCH}}

- name: Configure git
run: |
git remote add ${{env.REPO_NAME}} ${{env.REMOTE_URL}}
- name: Fetch remote homepage/dev and merge with local dev
id: fetch-merge
run: |
git fetch ${{env.REPO_NAME}}
git checkout ${{env.SYNC_BRANCH}}
lines=$( git diff ${{env.SYNC_BRANCH}}..${{env.REPO_NAME}}/${{env.SYNC_BRANCH}} -- . ':(exclude).github/**' | wc -l )
echo "Number of detected line changes: $lines"
if [ $lines -gt 0 ]; then
git merge --strategy-option ours ${{env.REPO_NAME}}/${{env.SYNC_BRANCH}}
git push
fi
shell: bash

sync-integration-branch:
name: Sync Integration Branch
runs-on: ubuntu-22.04
needs:
- sync-dev-branch

steps:
- name: Checkout dev
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
token: ${{ github.token }}
ref: ${{env.SYNC_BRANCH}}

- name: Checkout integration
uses: actions/checkout@v4
with:
ref: ${{env.MERGE_BRANCH}}
path: ${{env.MERGE_BRANCH}}

- name: Merge dev with integration
run: |
# git checkout ${{env.MERGE_BRANCH}}
git merge --strategy-option ours ${{env.SYNC_BRANCH}}
git push
shell: bash
76 changes: 0 additions & 76 deletions .github/workflows/sync-dev.yml

This file was deleted.

0 comments on commit 8942ce8

Please sign in to comment.