Skip to content

Commit

Permalink
MWPW-145389 Push sync for floodgate (#2655)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon32 authored Jul 30, 2024
1 parent 49df5f7 commit 538b3be
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/fg-sync-repos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Floodgate Repo Sync

on:
push:
branches:
- stage
- main
workflow_dispatch:
inputs:
syncBranch:
Expand Down Expand Up @@ -29,7 +33,7 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ inputs.syncBranch }}
ref: ${{ inputs.syncBranch || github.ref_name }}

- name: Clone Floodgate Repository and Checkout Selected Branch
run: |
Expand All @@ -42,7 +46,7 @@ jobs:
echo "milo branch"
git branch
env:
FG_SYNC_BRANCH: ${{ inputs.syncBranch }}
FG_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }}

- name: Overwrite floodgate repo files with latest from source repo
run: |
Expand All @@ -55,14 +59,19 @@ jobs:
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 $FG_SYNC_BRANCH --force
git status
if [[ -n $(git status -s) ]]; then
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 $FG_SYNC_BRANCH --force
echo ":heavy_check_mark: Syncing branch $FG_SYNC_BRANCH on milo to milo-pink completed successfully." >> $GITHUB_STEP_SUMMARY
else
echo ":heavy_minus_sign: No changes detected on branch $FG_SYNC_BRANCH, nothing to sync." >> $GITHUB_STEP_SUMMARY
fi
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 }}
FG_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }}

0 comments on commit 538b3be

Please sign in to comment.