Update branch.yaml #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ent-repo-sync | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
set -ex | |
export ENTERPRISE_REPO="https://github.com/kamal-devtron/testing.git" | |
git clone https://github.com/kamal-devtron/action-testing.git | |
git clone $ENTERPRISE_REPO | |
cd action-testing && export GIT_COMMIT_ID=`git log --format="%H" -n 1` | |
export GIT_COMMIT=${GIT_COMMIT_ID:0:8} | |
echo $GIT_COMMIT | |
git status && git checkout main && git pull | |
cd ../testing && git status && git checkout main && git pull | |
git config --global user.email kamal@devtron.ai | |
git config --global user.name kamal-devtron | |
if git rev-parse --verify main >/dev/null 2>&1; then | |
git checkout -b kamal | |
git remote add originpass https://kamal-devtron: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@github.com/kamal-devtron/action-testing.git | |
git push originpass kamal | |
else | |
echo "Branch does not exist" | |
fi | |
git remote add oss-devtron ../action-testing && git remote -v && git remote update && git merge oss-devtron/main | |
git commit -m "OSS main synced" && git status | |
git checkout -b oss-enterprise-sync-$GIT_COMMIT && git push -u origin oss-enterprise-sync-$GIT_COMMIT | |
PR_RESPONSE=$(gh pr create --title "SYNC: OSS sync for $GIT_COMMIT" --fill --base main --head oss-enterprise-sync-$GIT_COMMIT --repo $ENTERPRISE_REPO) | |
echo "FINAL PR RESPONSE: $PR_RESPONSE" | |