Skip to content

Commit 0fdbd84

Browse files
authored
Set title and description written in line-openapi PR (#633)
line/line-openapi#74
1 parent 5cfe2c9 commit 0fdbd84

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/diff-check.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,34 @@ jobs:
5757
echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
5858
- if: ${{ env.DIFF_IS_EMPTY != 'true' }}
5959
run: |
60+
BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}"
61+
6062
git config user.name github-actions
6163
git config user.email github-actions@github.com
62-
git checkout -b update-diff-${{ env.CURRENT_DATETIME }}
64+
git checkout -b $BRANCH_NAME
6365
6466
git add line-openapi
6567
git add src/**
6668
git commit --allow-empty -m "Codes are generated by openapi generator"
6769
6870
git add docs/**
69-
git commit --allow-empty -m "Update document"
71+
git commit --allow-empty -m "Update document"
72+
73+
git push origin $BRANCH_NAME
7074
71-
git push origin update-diff-${{ env.CURRENT_DATETIME }}
72-
gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update"
75+
# Determine PR title and body
76+
if [ "$CHANGE_TYPE" == "submodule-update" ]; then
77+
# Fetch PR info from submodule
78+
npx zx ./line-openapi/tools/get-pr-info.mjs
79+
PR_INFO=$(cat pr_info.json)
80+
TITLE=$(echo "$PR_INFO" | jq -r '.title')
81+
BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body')
82+
else
83+
# Default PR title and body
84+
TITLE="Codes are generated by openapi generator"
85+
BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠"
86+
fi
87+
88+
gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update"
7389
env:
7490
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)