Skip to content

Commit b44dde8

Browse files
authored
Set title and description written in line-openapi PR (#1494)
line/line-openapi#74
1 parent 52f1146 commit b44dde8

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/generate-code.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
distribution: 'temurin'
2525
java-version: 17
2626
architecture: x64
27+
- uses: actions/setup-node@v4
2728
- name: Generate code
2829
run: |
2930
python generate-code.py
@@ -39,14 +40,30 @@ jobs:
3940
## Run if diff exists and event is not pull request, and make PR
4041
- if: ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
4142
run: |
43+
BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
44+
4245
git config user.name github-actions
4346
git config user.email github-actions@github.com
44-
git checkout -b update-diff-${{ env.CURRENT_DATETIME }}
47+
git checkout -b $BRANCH_NAME
4548
4649
git add .
4750
git commit -m "Code are generated by openapi generator"
48-
git push origin update-diff-${{ env.CURRENT_DATETIME }}
4951
50-
gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update"
52+
git push origin $BRANCH_NAME
53+
54+
# Determine PR title and body
55+
if [ "$CHANGE_TYPE" == "submodule-update" ]; then
56+
# Fetch PR info from submodule
57+
npx zx ./line-openapi/tools/get-pr-info.mjs
58+
PR_INFO=$(cat pr_info.json)
59+
TITLE=$(echo "$PR_INFO" | jq -r '.title')
60+
BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
61+
else
62+
# Default PR title and body
63+
TITLE="Codes are generated by openapi generator"
64+
BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
65+
fi
66+
67+
gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
5168
env:
5269
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)