Skip to content

Commit

Permalink
MWPW-142006 - Enable repo-sync for graybox (adobecom#263)
Browse files Browse the repository at this point in the history
Enable CC repo-sync for CC graybox repo
Resolves: MWPW-142006
  • Loading branch information
arshadparwaiz authored Apr 11, 2024
1 parent 58a5a8b commit ea60f3c
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/graybox-sync-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Graybox Repo Sync

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

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: "cc-graybox"

- name: Checkout Repo
uses: actions/checkout@v2
with:
persist-credentials: false
ref: ${{ inputs.syncBranch }}

- name: Clone Graybox Repository and Checkout Stage Branch
run: |
git clone https://github.com/adobecom/cc-graybox.git ../cc-graybox
cd ../cc-graybox
git checkout $GB_SYNC_BRANCH
echo "cc-graybox branch"
git branch
cd ../cc
echo "cc branch"
git branch
env:
GB_SYNC_BRANCH: ${{ inputs.syncBranch }}

- name: Overwrite graybox 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' ./ ../cc-graybox/
- name: Commit and Push Changes to Graybox Repository
run: |
cd ../cc-graybox
echo "cc-graybox branch"
git branch
git config user.email "$FG_SYNC_BOT_EMAIL"
git config user.name "milo-repo-sync[bot]"
git status
git remote set-url origin https://oauth2:[email protected]/adobecom/cc-graybox.git
git remote -v
git add .
git commit -m "Syncing cc to cc-graybox"
git push origin $GB_SYNC_BRANCH --force
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
FG_SYNC_BOT_EMAIL: ${{ secrets.FG_SYNC_BOT_EMAIL }}
GB_SYNC_BRANCH: ${{ inputs.syncBranch }}

0 comments on commit ea60f3c

Please sign in to comment.