Skip to content

Commit 31c9c28

Browse files
committed
NO-ISSUE Set title and description written in line-openapi PR
1 parent 42835f1 commit 31c9c28

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.github/workflows/generated-code.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
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 github-actions@github.com
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

Comments
 (0)