Skip to content

Commit 561f11d

Browse files
authored
Set title and description written in line-openapi PR (#515)
line/line-openapi#74
1 parent 0a24b22 commit 561f11d

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
@@ -23,6 +23,7 @@ jobs:
2323
uses: actions/setup-python@v5
2424
with:
2525
python-version: '3.x'
26+
- uses: actions/setup-node@v4
2627
- name: Set up Go
2728
uses: actions/setup-go@v5
2829
with:
@@ -44,12 +45,30 @@ jobs:
4445
## Run if diff exists and event is not pull request, and make PR
4546
- if: ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
4647
run: |
48+
BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
49+
4750
git config user.name github-actions
4851
git config user.email github-actions@github.com
49-
git checkout -b update-diff-${{ env.CURRENT_DATETIME }}
52+
git checkout -b $BRANCH_NAME
53+
5054
git add .
5155
git commit -m "Code are generated by openapi generator"
52-
git push origin update-diff-${{ env.CURRENT_DATETIME }}
53-
gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update"
56+
57+
git push origin $BRANCH_NAME
58+
59+
# Determine PR title and body
60+
if [ "$CHANGE_TYPE" == "submodule-update" ]; then
61+
# Fetch PR info from submodule
62+
npx zx ./line-openapi/tools/get-pr-info.mjs
63+
PR_INFO=$(cat pr_info.json)
64+
TITLE=$(echo "$PR_INFO" | jq -r '.title')
65+
BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
66+
else
67+
# Default PR title and body
68+
TITLE="Codes are generated by openapi generator"
69+
BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
70+
fi
71+
72+
gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
5473
env:
5574
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)