Skip to content

Commit

Permalink
Merge branch 'main' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-devtron authored Nov 17, 2023
2 parents 5a2ad14 + 91b5bd6 commit fcf286d
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/another.yaml
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
28 changes: 28 additions & 0 deletions .github/workflows/branch.yaml
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
2 changes: 1 addition & 1 deletion .github/workflows/git-label-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
send-issue:
runs-on: ubuntu:latest
runs-on: ubuntu-latest
steps:
- if: contains(github.event.issue.labels.*.name, 'pager-duty')
name: custom issues
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/reposync.yaml
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 }}

2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu:latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<title>Document</title>
</head>
<body>

Kamal Acharya
=======

</body>
</html>
</html>

0 comments on commit fcf286d

Please sign in to comment.