16
16
# See the License for the specific language governing permissions and
17
17
# limitations under the License.
18
18
19
- # Script to create a sub-issue for linting failures
19
+ # Script to create a sub-issue.
20
20
#
21
- # Usage: ./create_lint_sub_issue .sh <workflow-url > <lint-type > <parent-issue-number>
21
+ # Usage: ./create_sub_issue .sh <issue-title > <body-file > <parent-issue-number>
22
22
#
23
23
# Arguments:
24
24
#
25
- # workflow-url URL of the workflow run .
26
- # lint-type Type of linting failure .
25
+ # issue-title Title for the new sub-issue .
26
+ # body-file Path to the file containing the issue body .
27
27
# parent-issue-number Number of the parent issue.
28
- # error-log-file Path to the error log file.
29
- #
30
28
#
31
29
# Environment variables:
32
30
#
@@ -41,10 +39,9 @@ set -o pipefail
41
39
# VARIABLES #
42
40
43
41
# Assign command line arguments to variables:
44
- workflow_url =" $1 "
45
- lint_type =" $2 "
42
+ issue_title =" $1 "
43
+ body_file =" $2 "
46
44
parent_issue_number=" $3 "
47
- error_log_file=" $4 "
48
45
49
46
# Repository information:
50
47
owner=" stdlib-js"
@@ -57,28 +54,12 @@ if [ -z "$github_token" ]; then
57
54
exit 1
58
55
fi
59
56
60
- # Read and format the error log
61
- if [ ! -f " $error_log_file " ]; then
62
- echo -e " Error log file not found: ${error_log_file } "
57
+ # Read and validate the body file:
58
+ if [ ! -f " $body_file " ]; then
59
+ echo -e " ERROR: Body file not found: ${body_file } "
63
60
exit 1
64
61
fi
65
- error_log_content=$( cat " $error_log_file " )
66
-
67
- # Create issue body with formatted error log
68
- issue_body=" ## ${lint_type} Linting Failures
69
-
70
- Linting failures were detected in the automated lint workflow run.
71
-
72
- ### Workflow Details
73
- - Run: ${workflow_url}
74
- - Type: ${lint_type} Linting
75
- - Date: $( date -u +" %Y-%m-%d %H:%M:%S UTC" )
76
-
77
- ### Error Details
78
- \`\`\`
79
- ${error_log_content}
80
- \`\`\`
81
- "
62
+ issue_body=$( cat " $body_file " )
82
63
83
64
# FUNCTIONS #
84
65
@@ -130,7 +111,7 @@ create_child_issue() {
130
111
"query": "mutation CreateIssue(\$ repositoryId: ID!, \$ title: String!, \$ body: String!) { createIssue(input: {repositoryId: \$ repositoryId, title: \$ title, body: \$ body}) { issue { id number } } }",
131
112
"variables": {
132
113
"repositoryId": "${repo_id} ",
133
- "title": "Fix ${lint_type} lint errors ",
114
+ "title": "${issue_title} ",
134
115
"body": $( echo " $issue_body " | jq -R -s ' .' )
135
116
}
136
117
}
@@ -194,7 +175,7 @@ main() {
194
175
exit 1
195
176
fi
196
177
197
- echo " Creating child issue for ${lint_type} lint failures ..."
178
+ echo " Creating child issue..."
198
179
child_issue_response=$( create_child_issue " $repo_id " " $issue_body " )
199
180
200
181
child_issue_id=$( echo " $child_issue_response " | jq -r ' .data.createIssue.issue.id' )
0 commit comments