1818 submodules : recursive
1919 - name : Update submodules
2020 run : git submodule update --remote --recursive
21+ - uses : actions/setup-node@v4
2122 - name : Set up Python
2223 uses : actions/setup-python@v5
2324 with :
@@ -36,12 +37,29 @@ jobs:
3637 # # Run if diff exists and event is not pull request, and make PR
3738 - if : ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
3839 run : |
40+ BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
41+
3942 git config user.name github-actions
4043 git config user.email [email protected] 41- git checkout -b update-diff-${{ env.CURRENT_DATETIME }}
44+ git checkout -b $BRANCH_NAME
45+
4246 git add .
4347 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+ # Determine PR title and body
50+ if [ "$CHANGE_TYPE" == "submodule-update" ]; then
51+ # Fetch PR info from submodule
52+ npx zx ./line-openapi/tools/get-pr-info.mjs
53+ PR_INFO=$(cat pr_info.json)
54+ TITLE=$(echo "$PR_INFO" | jq -r '.title')
55+ BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
56+ else
57+ # Default PR title and body
58+ TITLE="Codes are generated by openapi generator"
59+ BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
60+ fi
61+
62+ git push origin $BRANCH_NAME
63+ gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
4664 env :
4765 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments