@@ -212,23 +212,14 @@ jobs:
212
212
# echo "[$library_type/$language](https://github.com/${{github.repository}}/compare/$old_version_commit_hash..$new_version_commit_hash)" >> "$output_file"
213
213
214
214
215
- # Add type to output file
216
- message="""<details>
217
- <summary>${library_type}/${language}</summary>"""
215
+ # Add type to output file
216
+ echo "${library_type} ${language}" >> $output_file
218
217
219
- echo $message >> $output_file
218
+ # Add changes to output file
219
+ git diff HEAD~ >> $output_file
220
220
221
- echo "\`\`\`diff" >> $output_file
222
- echo """${message}""" >> $output_file
223
- echo "\`\`\`" >> $output_file
224
-
225
- # Add changes to output file
226
- git diff HEAD~ >> $output_file
227
-
228
- echo "</details>" >> $output_file
229
-
230
- # Add empty line
231
- echo \ >> $output_file
221
+ # Add empty line
222
+ echo \ >> $output_file
232
223
fi
233
224
}
234
225
@@ -292,11 +283,44 @@ jobs:
292
283
with :
293
284
github-token : ${{secrets.GITHUB_TOKEN}}
294
285
script : |
286
+ const replaceTable = {
287
+ "module-legacy": "Native module",
288
+ "module-mixed": "Turbo module with backward compat",
289
+ "module-new": "Turbo module",
290
+ "view-legacy": "Native view",
291
+ "view-mixed": "Fabric view with backward compat",
292
+ "view-new": "Fabric view",
293
+ "java-objc": "Java and Objective C",
294
+ "java-swift": "Java and Swift",
295
+ "kotlin-objc": "Kotlin and Objective C",
296
+ "kotlin-swift": "Kotlin and Swift"
297
+ }
298
+
295
299
const artifacts = `${{ steps.artifacts.outputs.ARTIFACTS }}`;
296
300
301
+ // Get every input by empty line
302
+
303
+ const splittedArtifacts = artifacts.split("\n\n")
304
+ const parsedArtifacts = splittedArtifacts.map((artifact) => {
305
+ // The first line indicates the type
306
+ const type = artifacts.split("\n").shift()
307
+ const typeReplaced = Object.entries(replaceTable).reduce((acc, [key, value]) => {
308
+ return acc.replace(new RegExp(key, "g"), value);
309
+ }, type)
310
+
311
+ return `<details>
312
+ <summary>${typeReplaced}</summary>
313
+ \`\`\`diff
314
+ ${artifact}
315
+ \`\`\`
316
+ </details>
317
+
318
+ `
319
+ })
320
+
297
321
const body = `🤓☝️ This PR changes the output of \`create-react-native-library\`. You can find the diffs of effected templates below:
298
322
299
- ${artifacts }
323
+ ${parsedArtifacts }
300
324
`;
301
325
302
326
const comments = await github.issues.listComments({
@@ -313,4 +337,4 @@ jobs:
313
337
repo: context.repo.repo,
314
338
body
315
339
})
316
-
340
+
0 commit comments