From ce736bbed4288a6bbf84c35976562fbcdda3c476 Mon Sep 17 00:00:00 2001 From: djeinstine Date: Sun, 24 Nov 2024 18:38:00 +0000 Subject: [PATCH] fix merge statement --- .github/workflows/sync-dev-integration.yml | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/sync-dev-integration.yml diff --git a/.github/workflows/sync-dev-integration.yml b/.github/workflows/sync-dev-integration.yml new file mode 100644 index 00000000..75238877 --- /dev/null +++ b/.github/workflows/sync-dev-integration.yml @@ -0,0 +1,65 @@ +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.MERGE_BRANCH}} + + - name: Merge integration with dev + run: | + git fetch origin ${{env.SYNC_BRANCH}} + git merge --strategy-option ours origin/${{env.SYNC_BRANCH}} + git push + shell: bash \ No newline at end of file