File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ RUN composer install --ansi --no-progress --no-interaction --prefer-dist
99## Compile runtime image
1010FROM wyrihaximusnet/php:7.4-nts-alpine-slim-root AS runtime
1111RUN mkdir /workdir
12- COPY ./entrypoint.sh ./comment.php ./composer.* /workdir/
12+ COPY ./entrypoint.sh ./comment.php ./post-process.php ./ composer.* /workdir/
1313COPY --from=install-dependencies /workdir/vendor/ /workdir/vendor/
1414ENTRYPOINT ["/workdir/entrypoint.sh"]
Original file line number Diff line number Diff line change @@ -12,6 +12,19 @@ production=$(cat /workdir/production.md)
1212/workdir/vendor/bin/composer-diff " ${GITHUB_BASE_REF} :composer.lock" " ${GITHUB_HEAD_REF} :composer.lock" --with-links --with-platform --no-prod -vvv > /workdir/development.md
1313development=$( cat /workdir/development.md)
1414
15+ echo " Raw:"
16+ echo " =================================================="
17+ echo " Production:"
18+ echo " ${production} "
19+ echo " --------------------------------------------------"
20+ echo " Development:"
21+ echo " ${development} "
22+
23+ php /workdir/post-process.php production
24+ php /workdir/post-process.php development
25+
26+ echo " Post Processed:"
27+ echo " =================================================="
1528echo " Production:"
1629echo " ${production} "
1730echo " --------------------------------------------------"
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require '/workdir/vendor/autoload.php ' ;
4+
5+ $ diff = file_get_contents ('/workdir/ ' . $ argv [1 ] . '.md ' );
6+
7+ preg_match_all ('/ \| dev-\b(\w.*)\b ([0-9a-f]{7}) \| / ' , $ diff , $ matches );
8+
9+ if (count ($ matches [2 ]) === 0 ) {
10+ exit (0 );
11+ }
12+
13+ $ lines = explode (PHP_EOL , $ diff );
14+ foreach ($ matches [2 ] as $ matchIndex => $ sha ) {
15+ foreach ($ lines as $ index => $ contents ) {
16+ if (strpos ($ contents , ' | 9999999-dev ' . $ sha . ' | dev- ' . $ matches [1 ][$ matchIndex ] . ' ' . $ sha . ' | ' ) !== false ) {
17+ unset($ lines [$ index ]);
18+ }
19+ }
20+ }
21+
22+ $ processedContents = implode (PHP_EOL , $ lines );
23+ if (strpos ($ processedContents , '[Compare] ' ) === false ) {
24+ $ processedContents = '' ;
25+ }
26+
27+ file_put_contents ('/workdir/ ' . $ argv [1 ] . '.md ' , $ processedContents );
You can’t perform that action at this time.
0 commit comments