18
18
submodules : recursive
19
19
- name : Update submodules
20
20
run : git submodule update --remote --recursive
21
+ - uses : actions/setup-node@v4
21
22
- name : Set up Python
22
23
uses : actions/setup-python@v5
23
24
with :
@@ -36,12 +37,30 @@ jobs:
36
37
# # Run if diff exists and event is not pull request, and make PR
37
38
- if : ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
38
39
run : |
40
+ BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
41
+
39
42
git config user.name github-actions
40
43
git config user.email github-actions@github.com
41
- git checkout -b update-diff-${{ env.CURRENT_DATETIME }}
44
+ git checkout -b $BRANCH_NAME
45
+
42
46
git add .
43
47
git commit -m "Code are generated by openapi generator"
44
- git push origin update-diff-${{ env.CURRENT_DATETIME }}
45
- gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update"
48
+
49
+ git push origin $BRANCH_NAME
50
+
51
+ # Determine PR title and body
52
+ if [ "$CHANGE_TYPE" == "submodule-update" ]; then
53
+ # Fetch PR info from submodule
54
+ npx zx ./line-openapi/tools/get-pr-info.mjs
55
+ PR_INFO=$(cat pr_info.json)
56
+ TITLE=$(echo "$PR_INFO" | jq -r '.title')
57
+ BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
58
+ else
59
+ # Default PR title and body
60
+ TITLE="Codes are generated by openapi generator"
61
+ BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
62
+ fi
63
+
64
+ gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
46
65
env :
47
66
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments