Skip to content

Commit

Permalink
MWPW-143638: Repo sync script update (#2134)
Browse files Browse the repository at this point in the history
Provides options to sync stage-to-stage or main-to-main sycn between repos
  • Loading branch information
sukamat authored Apr 12, 2024
1 parent fcbae38 commit 1ef5cff
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/fg-sync-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ name: Floodgate Repo Sync

on:
workflow_dispatch:
inputs:
syncBranch:
description: 'Branch to sync'
required: true
default: 'stage'
type: choice
options:
- 'stage'
- 'main'

jobs:
build:
Expand All @@ -20,27 +29,40 @@ jobs:
uses: actions/checkout@v2
with:
persist-credentials: false
ref: ${{ inputs.syncBranch }}

- name: Clone Floodgate Repository
- name: Clone Floodgate Repository and Checkout Selected Branch
run: |
git clone https://github.com/adobecom/milo-pink.git ../milo-pink
cd ../milo-pink
git checkout $FG_SYNC_BRANCH
echo "milo-pink branch"
git branch
cd ../milo
echo "milo branch"
git branch
env:
FG_SYNC_BRANCH: ${{ inputs.syncBranch }}

- name: Overwrite floodgate repo files with latest from source repo
run: |
rsync -av --exclude='fstab.yaml' --exclude='.github' --exclude='.git' --exclude='.idea' ./ ../milo-pink/
rsync -av --exclude='fstab.yaml' --exclude='.github' --exclude='.kodiak' --exclude='.git' --exclude='.idea' --exclude='.husky' --exclude='.vscode' --exclude='tools/sidekick/config.json' ./ ../milo-pink/
- name: Commit and Push Changes to Floodgate Repository
run: |
cd ../milo-pink
echo "milo-pink branch"
git branch
git config user.email "$FG_SYNC_BOT_EMAIL"
git config user.name "$FG_SYNC_BOT_NAME"
git status
git remote set-url origin https://oauth2:$GITHUB_TOKEN@github.com/adobecom/milo-pink.git
git remote -v
git add .
git commit -m "Syncing milo to milo-pink"
git push origin main --force
git push origin $FG_SYNC_BRANCH --force
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
FG_SYNC_BOT_EMAIL: ${{ secrets.FG_SYNC_BOT_EMAIL }}
FG_SYNC_BOT_NAME: ${{ secrets.FG_SYNC_BOT_NAME }}
FG_SYNC_BRANCH: ${{ inputs.syncBranch }}

0 comments on commit 1ef5cff

Please sign in to comment.