File tree Expand file tree Collapse file tree 2 files changed +67
-11
lines changed Expand file tree Collapse file tree 2 files changed +67
-11
lines changed Original file line number Diff line number Diff line change 51
51
-f ${{ env.KUBERNETES_MANIFEST_FILE_PATH }} \
52
52
-r ${{ env.AZURE_CONTAINER_REGISTRY }} \
53
53
-t ${{ env.IMAGE_TAG }}
54
-
55
- rm -rf cicd-deployment-scripts
56
54
57
55
git config --global user.email "[email protected] "
58
56
git config --global user.name "GitHub Actions"
@@ -65,12 +63,12 @@ jobs:
65
63
if [ ${{ github.event_name }} == 'release' ]; then
66
64
PR_TITLE="ci(${{ github.ref_name }}): $AUTOMATED_RELEASE_BRANCH"
67
65
fi
68
-
69
- gh pr create \
70
- --base dev \
71
- --head $AUTOMATED_RELEASE_BRANCH \
72
- --title "$PR_TITLE" \
73
- --body "Automated release for ${{ github.event.repository.name }}:\n- $KUBERNETES_POD_NEW_IMAGE:${{ env.IMAGE_TAG }}" \
74
- --draft \
75
- --repo ${{ github.repository_owner }}/${{ env.KUBERNETES_CLUSTER_REPO_NAME }} || true
76
- # --reviewer ${{ github.repository_owner }}/devops-admin \
66
+
67
+ bash cicd-deployment-scripts/gh/pr_create.sh \
68
+ -b ${{ github.event_name == 'release' && 'prod' || ' dev' }} \
69
+ -h " $AUTOMATED_RELEASE_BRANCH" \
70
+ -t "$PR_TITLE" \
71
+ -o " ${{ github.repository_owner }}" \
72
+ -r "${{ github.event.repository.name }}" \
73
+ -p "$KUBERNETES_POD_NEW_IMAGE" \
74
+ -k " ${{ env.KUBERNETES_CLUSTER_REPO_NAME }}" \
Original file line number Diff line number Diff line change
1
+ # !/bin/bash
2
+ set -e
3
+
4
+ BASE_REF=" dev"
5
+ HEAD_REF=" automated-release-dev"
6
+ PR_TITLE=" ci: automated-release-dev"
7
+ REPOSITORY_OWNER=" code-kern-ai"
8
+ REPOSITORY_NAME=" "
9
+ POD_IMAGE_NAME=" "
10
+ KUBERNETES_CLUSTER_REPO_NAME=" "
11
+
12
+ while getopts b:h:t:o:r:p:k: flag
13
+ do
14
+ case " ${flag} " in
15
+ b) BASE_REF=${OPTARG} ;;
16
+ h) HEAD_REF=${OPTARG} ;;
17
+ t) PR_TITLE=${OPTARG} ;;
18
+ o) REPOSITORY_OWNER=${OPTARG} ;;
19
+ r) REPOSITORY_NAME=${OPTARG} ;;
20
+ p) POD_IMAGE_NAME=${OPTARG} ;;
21
+ k) KUBERNETES_CLUSTER_REPO_NAME=${OPTARG} ;;
22
+ esac
23
+ done
24
+
25
+ EXISTING_PR_NUMBER=" "
26
+ EXISTING_PR_BODY=$( gh pr list --base $BASE_REF --head $HEAD_REF --json body --jq ' .[].body' )
27
+
28
+ if [ -z " $EXISTING_PR_BODY " ]; then
29
+ PR_BODY=$( cat << EOF
30
+ Automated $BASE_REF release:
31
+ - $POD_IMAGE_NAME
32
+ EOF
33
+ )
34
+ gh pr create \
35
+ --base $BASE_REF \
36
+ --head $HEAD_REF \
37
+ --title " $PR_TITLE " \
38
+ --body " $PR_BODY " \
39
+ --draft \
40
+ --repo $REPOSITORY_OWNER /$KUBERNETES_CLUSTER_REPO_NAME
41
+ # --reviewer $REPOSITORY_OWNER/devops-admin \
42
+
43
+ else
44
+ EXISTING_PR_NUMBER=$( gh pr list \
45
+ --base $BASE_REF \
46
+ --head $HEAD_REF \
47
+ --repo $REPOSITORY_OWNER /$KUBERNETES_CLUSTER_REPO_NAME \
48
+ --json number --jq ' .[].number' )
49
+ PR_BODY=$( cat << EOF
50
+ $EXISTING_PR_BODY
51
+ - $POD_IMAGE_NAME
52
+ EOF
53
+ )
54
+ gh pr edit $EXISTING_PR_NUMBER \
55
+ --body " $PR_BODY " \
56
+ --repo $REPOSITORY_OWNER /$KUBERNETES_CLUSTER_REPO_NAME || true
57
+ fi
58
+
You can’t perform that action at this time.
0 commit comments