Skip to content

Commit c902425

Browse files
authored
Set title and description written in line-openapi PR again (#646)
same as line/line-bot-sdk-nodejs#1123
1 parent 8b47460 commit c902425

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

.github/workflows/diff-check.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ jobs:
6767
## Run if diff exists and event is not pull request, and make PR
6868
- if: ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
6969
run: |
70+
# Determine Change Type via Submodule Script. This scripts read current uncommited changes.
71+
CHANGE_TYPE=$(npx zx ./line-openapi/tools/determine-change-type.mjs)
72+
echo "Determined change type: $CHANGE_TYPE"
73+
74+
# Determine PR title and body
75+
if [ "$CHANGE_TYPE" == "submodule-update" ]; then
76+
# Fetch PR info from submodule
77+
npx zx ./line-openapi/tools/get-pr-info.mjs
78+
PR_INFO=$(cat pr_info.json)
79+
TITLE=$(echo "$PR_INFO" | jq -r '.title')
80+
BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
81+
else
82+
# Default PR title and body
83+
TITLE="Codes are generated by openapi generator"
84+
BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
85+
fi
86+
87+
# Create PR
7088
BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
7189
7290
git config user.name github-actions
@@ -81,19 +99,6 @@ jobs:
8199
git commit --allow-empty -m "Update document"
82100
83101
git push origin $BRANCH_NAME
84-
85-
# Determine PR title and body
86-
if [ "$CHANGE_TYPE" == "submodule-update" ]; then
87-
# Fetch PR info from submodule
88-
npx zx ./line-openapi/tools/get-pr-info.mjs
89-
PR_INFO=$(cat pr_info.json)
90-
TITLE=$(echo "$PR_INFO" | jq -r '.title')
91-
BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
92-
else
93-
# Default PR title and body
94-
TITLE="Codes are generated by openapi generator"
95-
BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
96-
fi
97102
98103
gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
99104
env:

0 commit comments

Comments
 (0)