Skip to content

Commit

Permalink
Post GitHub comment with statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
daohoangson committed Sep 21, 2023
1 parent 6202ac7 commit deb0e9f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/osm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ jobs:
- name: Build demo/parser CLI
run: bun install && npm run bun:build
working-directory: demo/parser
- run: php transformers/osm/split.php
- run: php transformers/osm/split.php | tee split.log

- name: Prepare GitHub comment
id: comment
run: printf 'BODY<<EOF\n%s\nEOF\n' "$(cat split.log)" >> $GITHUB_OUTPUT
- name: Post GitHub comment
uses: daohoangson/comment-on-github@35b21121fdbadf807678bec8210cdd7f22a934fe # v2.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ${{ steps.comment.outputs.BODY }}
fingerprint: "### Statistics"
6 changes: 3 additions & 3 deletions transformers/osm/split.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ function main()
$array[$item['id']] = $item;
}

fwrite(STDOUT, sprintf("Paths: %d -> items: %d\n", $pathCount, count($array)));
fwrite(STDERR, sprintf("Paths: %d -> items: %d\n", $pathCount, count($array)));

foreach ($array as $item) {
if (isset($workingWrittenPaths[$item['path']])) {
statisticsTrack($outDir, $item['path'], $workingWrittenPaths[$item['path']]);
fwrite(STDOUT, 'w'); // already written
fwrite(STDERR, 'w'); // already written
continue;
}

Expand All @@ -84,7 +84,7 @@ function main()
$workingWrittenPaths[$item['path']] = $jsonFullPath;
statisticsTrack($outDir, $item['path'], $jsonFullPath);
file_put_contents($workingFilePath, json_encode(compact('workingWrittenPaths')));
fwrite(STDOUT, '.');
fwrite(STDERR, '.');
continue;
}

Expand Down

0 comments on commit deb0e9f

Please sign in to comment.