Skip to content

Commit 09937ad

Browse files
committed
chore: tsetingg
1 parent 6227760 commit 09937ad

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

.github/workflows/comment-diffs.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ jobs:
145145
source ../configMatrix/configMatrix.sh
146146
147147
output_path="../outputs"
148-
output_file="$output_path/output.txt"
149148
150149
mkdir -p "$output_path"
151150
@@ -155,6 +154,7 @@ jobs:
155154
function copy_commit_diff(){
156155
library_type=$1
157156
language=$2
157+
output_file="$output_path/$library_type-$language.txt"
158158
159159
path_prefix="../test/$library_type/$language"
160160
target_path_new_version="$path_prefix/new-version"
@@ -211,15 +211,8 @@ jobs:
211211
# Add output to file
212212
# echo "[$library_type/$language](https://github.com/${{github.repository}}/compare/$old_version_commit_hash..$new_version_commit_hash)" >> "$output_file"
213213
214-
215-
# Add type to output file
216-
echo "${library_type} ${language}" >> $output_file
217-
218214
# Add changes to output file
219215
git diff HEAD~ >> $output_file
220-
221-
# Add empty line
222-
echo \ >> $output_file
223216
fi
224217
}
225218
@@ -281,10 +274,6 @@ jobs:
281274
script: |
282275
const fs = require('fs');
283276
284-
fs.readdirSync('./outputs').forEach(file => {
285-
console.log(file);
286-
});
287-
288277
const replaceTable = {
289278
"module-legacy": "Native module",
290279
"module-mixed": "Turbo module with backward compat",
@@ -298,19 +287,16 @@ jobs:
298287
"kotlin-swift": "Kotlin and Swift"
299288
}
300289
301-
const artifacts = `${{ steps.artifacts.outputs.ARTIFACTS }}`;
302-
303-
// Get every input by empty line
290+
const parsedArtifacts = fs.readdirSync('./outputs').map(fileName => {
291+
const [type, language] = fileName.split("-");
304292
305-
const splittedArtifacts = artifacts.split("\n\n")
306-
const parsedArtifacts = splittedArtifacts.map((artifact) => {
307-
// The first line indicates the type
308-
const type = artifacts.split("\n").shift()
309-
const typeReplaced = Object.entries(replaceTable).reduce((acc, [key, value]) => {
293+
const header = Object.entries(replaceTable).reduce((acc, [key, value]) => {
310294
return acc.replace(new RegExp(key, "g"), value);
311-
}, type)
295+
}, `${type} ${language}`);
296+
297+
const fileContents = fs.readFileSync(`./outputs/${fileName}`, 'utf8');
312298
313-
return `<details><summary>${typeReplaced}</summary>\n\n\`\`\`diff\n${artifact}\n\`\`\`\n</details>\n\n`;
299+
return `<details><summary>${header}</summary>\n\n\`\`\`diff\n${fileContents}\n\`\`\`\n</details>\n\n`;
314300
})
315301
316302
const body = `🤓☝️ This PR changes the output of \`create-react-native-library\`. You can find the diffs of effected templates below:

0 commit comments

Comments
 (0)