@@ -13,26 +13,25 @@ jobs:
1313 pull-requests : write
1414
1515 env :
16+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1617 FEATURE_NAME : testRes
17- DEV_ASSIGNEE : dev-user
18- DOC_ASSIGNEE : doc-user
19- QA_ASSIGNEE : qa-user
20- RELEASE_ASSIGNEE : release-owner
18+ DEV_ASSIGNEE : Vahila
19+ DOC_ASSIGNEE : Vahila
20+ QA_ASSIGNEE : Vahila
21+ RELEASE_ASSIGNEE : Vahila
2122
2223 steps :
2324 - name : Checkout repository
2425 uses : actions/checkout@v4
2526 with :
2627 fetch-depth : 0
2728
28- - name : Install GitHub CLI
29+ - name : Set up GH CLI
2930 run : |
3031 sudo apt update
31- sudo apt install -y gh
32+ sudo apt install -y gh jq
3233
3334 - name : Authenticate GH CLI
34- env :
35- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3635 run : |
3736 gh auth setup-git
3837 gh auth status
4443
4544 echo "Creating branches for feature: $fname"
4645
47- # Helper to create branch from base if not exists
4846 create_branch() {
4947 branch=$1
5048 from=$2
6462 create_branch feature/$fname $base
6563
6664 - name : Create draft PRs
67- env :
68- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6965 run : |
7066 fname=${FEATURE_NAME}
7167
@@ -75,18 +71,25 @@ jobs:
7571 head=$1
7672 base=$2
7773 title=$3
74+ body=$3
7875 assignee=$4
7976
80- # Check if PR already exists
81- if gh pr list --head "$head" --base "$base" --json headRefName,baseRefName | jq -e '.[]' >/dev/null; then
82- echo "PR from $head to $base already exists, skipping."
83- else
77+ existing_pr=$(gh pr list --head "$head" --base "$base" --json headRefName,baseRefName --jq '.[]')
78+ if [ -z "$existing_pr" ]; then
8479 echo "Creating PR: $head → $base"
85- gh pr create --base "$base" --head "$head" --title "$title" --draft ${assignee:+--assignee "$assignee"}
80+ gh pr create \
81+ --base "$base" \
82+ --head "$head" \
83+ --title "$title" \
84+ --body "$body" \
85+ --draft \
86+ ${assignee:+--assignee "$assignee"}
87+ else
88+ echo "PR from $head to $base already exists, skipping."
8689 fi
8790 }
8891
8992 create_pr src/$fname feature/$fname "Source changes for $fname" "$DEV_ASSIGNEE"
9093 create_pr doc/$fname feature/$fname "Docs for $fname" "$DOC_ASSIGNEE"
9194 create_pr test/$fname src/$fname "Tests for $fname" "$QA_ASSIGNEE"
92- create_pr feature/$fname master "Integrate $fname" "$RELEASE_ASSIGNEE"
95+ create_pr feature/$fname master "Final changes for $fname" "$RELEASE_ASSIGNEE"
0 commit comments