From 3b30e4dc8acbb8485d5e5d79ae1ee4770e539697 Mon Sep 17 00:00:00 2001 From: Yuta Kasai Date: Tue, 26 Nov 2024 12:13:04 +0900 Subject: [PATCH] NO-ISSUE Set title and description written in line-openapi PR --- .github/workflows/diff-check.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/diff-check.yml b/.github/workflows/diff-check.yml index ae88a1eb..41c012c1 100644 --- a/.github/workflows/diff-check.yml +++ b/.github/workflows/diff-check.yml @@ -57,18 +57,32 @@ jobs: echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV - if: ${{ env.DIFF_IS_EMPTY != 'true' }} run: | + BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}" + git config user.name github-actions git config user.email github-actions@github.com - git checkout -b update-diff-${{ env.CURRENT_DATETIME }} + git checkout -b $BRANCH_NAME git add line-openapi git add src/** git commit --allow-empty -m "Codes are generated by openapi generator" - + git add docs/** git commit --allow-empty -m "Update document" - - git push origin update-diff-${{ env.CURRENT_DATETIME }} - gh pr create -B ${{ github.ref_name }} -t "Codes are generated by openapi generator" -b "" --label "line-openapi-update" + git push origin $BRANCH_NAME + + # Determine PR title and body + if [ "$CHANGE_TYPE" == "submodule-update" ]; then + # Fetch PR info from submodule + npx zx ./line-openapi/tools/get-pr-info.mjs + PR_INFO=$(cat pr_info.json) + TITLE=$(echo "$PR_INFO" | jq -r '.title') + BODY=$(echo "$PR_INFO" | jq -r '.url')$'\n\n'$(echo "$PR_INFO" | jq -r '.body') + else + # Default PR title and body + TITLE="Codes are generated by openapi generator" + BODY="⚠Reviewer: Please edit this description to include relevant information about the changes.⚠" + fi + gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}