-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
134 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Create and Push Branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Change this to your source branch | ||
|
||
jobs: | ||
create-and-push-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Git credentials for source repository | ||
run: | | ||
git config user.name "kamal-devtron" | ||
git config user.email "kamal@devtron.ai" | ||
- name: Create and push branch | ||
run: | | ||
SOURCE_BRANCH_NAME=main # Change this to your source branch | ||
TARGET_BRANCH_NAME=feature/my-new-branch # Change this to the branch you want to create in the target repository | ||
# Create a new branch in the source repository | ||
git checkout -b $TARGET_BRANCH_NAME | ||
git push origin $TARGET_BRANCH_NAME | ||
# Clone the target repository | ||
git clone --depth=1 https://github.com/kamal-devtron/testing.git testing | ||
cd testing | ||
# Fetch the new branch from the source repository | ||
git pull origin main | ||
git checkout -b $TARGET_BRANCH_NAME | ||
git fetch origin | ||
git pull | ||
|
||
# Push the new branch to the target repository | ||
git push origin $TARGET_BRANCH_NAME |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Create Branch if Not Present | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Change this to your base branch | ||
|
||
jobs: | ||
create-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check if branch exists | ||
id: check-branch | ||
run: | | ||
BRANCH_NAME=main # Change this to the branch you want to create | ||
API_URL="https://api.github.com/repos/${{ github.repository }}/branches/${BRANCH_NAME}" | ||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "$API_URL") | ||
echo "::set-output name=branch_exists::$(if [ $RESPONSE -eq 200 ]; then echo 'true'; else echo 'false'; fi)" | ||
- name: Create branch if not present | ||
if: steps.check-branch.outputs.branch_exists == 'false' | ||
run: | | ||
BRANCH_NAME=main # Change this to the branch you want to create | ||
git checkout -b $BRANCH_NAME | ||
git push origin $BRANCH_NAME |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
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 GIT_USERNAME="${GIT_CONFIG_NAME}" | ||
export GIT_PASSWORD="${GH_TOKEN}" | ||
export ENTERPRISE_REPO="https://${GIT_USERNAME}:${GIT_PASSWORD}@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` | ||
git config --global user.email $GIT_CONFIG_EMAIL | ||
git config --global user.name $GIT_USERNAME | ||
export GIT_COMMIT=${GIT_COMMIT_ID:0:8} | ||
echo $GIT_COMMIT | ||
git status && git checkout main && git pull && rm -rf .github | ||
git add . && git commit -m "removal of .github" | ||
cd ../testing && git status && git checkout main && git pull | ||
git config --global user.email $GIT_CONFIG_EMAIL | ||
git config --global user.name $GIT_USERNAME | ||
if git rev-parse --verify origin/release-candidate >/dev/null 2>&1; then | ||
echo "Branch exsist" | ||
else | ||
git checkout -b release-candidate | ||
git push -u origin release-candidate | ||
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" | ||
env: | ||
GH_TOKEN: ${{ secrets.GIT_TARGET_TOKEN }} | ||
GIT_CONFIG_NAME: ${{ secrets.GIT_TARGET_USERNAME }} | ||
GIT_CONFIG_EMAIL: ${{ secrets.GIT_TARGET_EMAIL }} | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
<title>Document</title> | ||
</head> | ||
<body> | ||
|
||
Kamal Acharya | ||
======= | ||
|
||
</body> | ||
</html> | ||
</html> |