|
67 | 67 | ## Run if diff exists and event is not pull request, and make PR |
68 | 68 | - if: ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }} |
69 | 69 | 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 |
70 | 88 | BRANCH_NAME="update-diff-${{ env.CURRENT_DATETIME }}" |
71 | 89 | |
72 | 90 | git config user.name github-actions |
|
81 | 99 | git commit --allow-empty -m "Update document" |
82 | 100 | |
83 | 101 | 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 |
97 | 102 |
|
98 | 103 | gh pr create -B ${{ github.ref_name }} -H $BRANCH_NAME -t "$TITLE" -b "$BODY" --label "line-openapi-update" |
99 | 104 | env: |
|
0 commit comments