Skip to content

Merge branch 'main' into stage #50

Merge branch 'main' into stage

Merge branch 'main' into stage #50

Workflow file for this run

name: Floodgate Repo Sync
on:
push:
branches:
- stage
- main
workflow_dispatch:
inputs:
syncBranch:
description: 'Branch to sync'
required: true
default: 'stage'
type: choice
options:
- 'stage'
- 'main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.FG_SYNC_APP_ID }}
private-key: ${{ secrets.FG_SYNC_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "bacom-pink"
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ inputs.syncBranch || github.ref_name }}
- name: Clone Floodgate Repository and Checkout Selected Branch
run: |
git clone https://github.com/adobecom/bacom-pink.git ../bacom-pink
cd ../bacom-pink
git checkout $FG_SYNC_BRANCH
echo "bacom-pink branch"
git branch
cd ../bacom
echo "bacom branch"
git branch
env:
FG_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }}
- name: Overwrite floodgate repo files with latest from source repo
run: |
rsync -av --exclude='fstab.yaml' --exclude='.github' --exclude='.kodiak' --exclude='.git' --exclude='.idea' --exclude='.husky' --exclude='.vscode' --exclude='tools/sidekick/config.json' ./ ../bacom-pink/
- name: Commit and Push Changes to Floodgate Repository
run: |
cd ../bacom-pink
echo "bacom-pink branch"
git branch
git config user.email "$FG_SYNC_BOT_EMAIL"
git config user.name "$FG_SYNC_BOT_NAME"
git status
if [[ -n $(git status -s) ]]; then
git remote set-url origin https://oauth2:[email protected]/adobecom/bacom-pink.git
git remote -v
git add .
git commit -m "Syncing bacom to bacom-pink"
git push origin $FG_SYNC_BRANCH --force
echo ":heavy_check_mark: Syncing branch $FG_SYNC_BRANCH on bacom to bacom-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 || github.ref_name }}