@@ -48,15 +48,35 @@ jobs:
48
48
# # Run if diff exists and event is not pull request, and make PR
49
49
- if : ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
50
50
run : |
51
+ BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
52
+
51
53
git config user.name github-actions
52
54
git config user.email [email protected]
53
- git checkout -b update-diff-${{ env.CURRENT_DATETIME }}
55
+ git checkout -b $BRANCH_NAME
54
56
55
57
git add line-openapi
56
58
git add lib/**
57
59
git commit -m "Codes are generated by openapi"
58
60
59
- git push origin update-diff-${{ env.CURRENT_DATETIME }}
60
- gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update"
61
+ git push origin $BRANCH_NAME
62
+
63
+ # Determine Change Type via Submodule Script
64
+ CHANGE_TYPE=$(npx zx ./line-openapi/tools/determine-change-type.mjs)
65
+ echo "Determined change type: $CHANGE_TYPE"
66
+
67
+ # Determine PR title and body
68
+ if [ "$CHANGE_TYPE" == "submodule-update" ]; then
69
+ # Fetch PR info from submodule
70
+ npx zx ./line-openapi/tools/get-pr-info.mjs
71
+ PR_INFO=$(cat pr_info.json)
72
+ TITLE=$(echo "$PR_INFO" | jq -r '.title')
73
+ BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
74
+ else
75
+ # Default PR title and body
76
+ TITLE="Codes are generated by openapi generator"
77
+ BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
78
+ fi
79
+
80
+ gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
61
81
env :
62
82
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments