Nikita Kohli commited on
Commit
fc92bd3
·
unverified ·
1 Parent(s): 91c2739

Update ci-cd.yml

Browse files
Files changed (1) hide show
  1. .github/workflows/ci-cd.yml +22 -3
.github/workflows/ci-cd.yml CHANGED
@@ -7,13 +7,19 @@ on:
7
  - develop
8
  - main
9
 
 
 
 
 
10
  jobs:
11
  build:
12
  runs-on: ubuntu-latest
13
  steps:
14
  - name: Checkout Code
15
  uses: actions/checkout@v3
16
-
 
 
17
  - name: Set up Python
18
  uses: actions/setup-python@v3
19
  with:
@@ -35,10 +41,22 @@ jobs:
35
  with:
36
  fetch-depth: 0
37
 
38
- - name: Set up Git
39
  run: |
40
  git config --global user.name "GitHub Actions"
41
  git config --global user.email "[email protected]"
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  - name: Merge feature branch to develop
44
  run: |
@@ -57,10 +75,11 @@ jobs:
57
  with:
58
  fetch-depth: 0
59
 
60
- - name: Set up Git
61
  run: |
62
  git config --global user.name "GitHub Actions"
63
  git config --global user.email "[email protected]"
 
64
 
65
  - name: Merge develop branch to main
66
  run: |
 
7
  - develop
8
  - main
9
 
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
13
+
14
  jobs:
15
  build:
16
  runs-on: ubuntu-latest
17
  steps:
18
  - name: Checkout Code
19
  uses: actions/checkout@v3
20
+ with:
21
+ fetch-depth: 0
22
+
23
  - name: Set up Python
24
  uses: actions/setup-python@v3
25
  with:
 
41
  with:
42
  fetch-depth: 0
43
 
44
+ - name: Set up Git authentication
45
  run: |
46
  git config --global user.name "GitHub Actions"
47
  git config --global user.email "[email protected]"
48
+ git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
49
+
50
+ - name: Ensure develop branch exists
51
+ run: |
52
+ git fetch origin
53
+ if git show-ref --verify --quiet refs/remotes/origin/develop; then
54
+ echo "Develop branch exists."
55
+ else
56
+ echo "Creating develop branch."
57
+ git checkout -b develop
58
+ git push origin develop
59
+ fi
60
 
61
  - name: Merge feature branch to develop
62
  run: |
 
75
  with:
76
  fetch-depth: 0
77
 
78
+ - name: Set up Git authentication
79
  run: |
80
  git config --global user.name "GitHub Actions"
81
  git config --global user.email "[email protected]"
82
+ git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
83
 
84
  - name: Merge develop branch to main
85
  run: |