Skip to content

Commit 01dd23a

Browse files
authored
Set title and description written in line-openapi PR (#721)
line/line-openapi#74
1 parent da73604 commit 01dd23a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/generated-code.yml

Lines changed: 22 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,30 @@ 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+
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"
4665
env:
4766
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)