Skip to content

Commit d2af46a

Browse files
authored
Merge pull request #1436 from flatcar/t-lo/split-contrib-report
Contributors report: split report to work around max body size
2 parents e7f4a51 + a6f538f commit d2af46a

File tree

1 file changed

+109
-84
lines changed

1 file changed

+109
-84
lines changed

.github/workflows/issue-pr-contrib-metrics.yaml

+109-84
Original file line numberDiff line numberDiff line change
@@ -287,152 +287,177 @@ jobs:
287287
run: |
288288
set -euo pipefail
289289
290+
echo -e '# Contributions, Discussions, Advisories, and Issues' >> summary_report.md
291+
echo "(See comment below for Pull Request Metrics)" >> summary_report.md
292+
290293
# Create table of contents.
291294
# Anchor targets defined here are created below when the respective section is added.
292-
echo "# Contents" >> report.md
293-
echo "* [Contributors Metrics](#contributors-metrics)" >> report.md
294-
echo "* [Github Discussions Metrics](#discussions-metrics)" >> report.md
295-
echo " * [Questions and Answers Discussions](#discussions-metrics-qna)" >> report.md
296-
echo " * [Other Discussions](#discussions-metrics-other)" >> report.md
297-
echo "* [Issue Metrics](#issue-metrics)" >> report.md
298-
echo " * [Summary of all open Issues](#issue-metrics-summary)" >> report.md
299-
echo " * [New Issues](#issue-metrics-new)" >> report.md
300-
echo " * [Closed Issues](#issue-metrics-closed)" >> report.md
301-
echo "* [Advisory Metrics](#advisory-metrics)" >> report.md
302-
echo " * [New Advisories](#advisory-metrics-new)" >> report.md
303-
echo " * [Closed Advisories](#advisory-metrics-closed)" >> report.md
304-
echo " * [All open Advisories](#advisory-metrics-summary)" >> report.md
305-
echo "* [Pull Requests Metrics](#pr-metrics)" >> report.md
306-
echo " * [Summary of all open PRs](#pr-metrics-summary)" >> report.md
307-
echo " * [New PRs](#pr-metrics-new)" >> report.md
308-
echo " * [Closed PRs](#pr-metrics-closed)" >> report.md
295+
echo "# Contents" >> summary_report.md
296+
echo "* [Contributors Metrics](#contributors-metrics)" >> summary_report.md
297+
echo "* [Github Discussions Metrics](#discussions-metrics)" >> summary_report.md
298+
echo " * [Questions and Answers Discussions](#discussions-metrics-qna)" >> summary_report.md
299+
echo " * [Other Discussions](#discussions-metrics-other)" >> summary_report.md
300+
echo "* [Advisory Metrics](#advisory-metrics)" >> summary_report.md
301+
echo " * [New Advisories](#advisory-metrics-new)" >> summary_report.md
302+
echo " * [Closed Advisories](#advisory-metrics-closed)" >> summary_report.md
303+
echo " * [All open Advisories](#advisory-metrics-summary)" >> summary_report.md
304+
echo "* [Issue Metrics](#issue-metrics)" >> summary_report.md
305+
echo " * [Summary of all open Issues](#issue-metrics-summary)" >> summary_report.md
306+
echo " * [New Issues](#issue-metrics-new)" >> summary_report.md
307+
echo " * [Closed Issues](#issue-metrics-closed)" >> summary_report.md
309308
310309
#
311310
# Contributors
312311
#
313-
echo -e '\n\n<h1 id="contributors-metrics">Contributors Metrics</h1>' >> report.md
314-
tail --lines=+2 contributors.md >> report.md
312+
echo -e '\n\n<h1 id="contributors-metrics">Contributors Metrics</h1>' >> summary_report.md
313+
tail --lines=+2 contributors.md >> summary_report.md
315314
316315
#
317316
# Discussions
318317
#
319-
echo -e '\n\n<h1 id="discussions-metrics">Discussions Metrics</h1>' >> report.md
320-
echo -e '\n<h2 id="discussions-metrics-qna">Questions & Answers</h2>' >> report.md
321-
echo -e "\n### Summary of all unanswered Questions" >> report.md
318+
echo -e '\n\n<h1 id="discussions-metrics">Discussions Metrics</h1>' >> summary_report.md
319+
echo -e '\n<h2 id="discussions-metrics-qna">Questions & Answers</h2>' >> summary_report.md
320+
echo -e "\n### Summary of all unanswered Questions" >> summary_report.md
322321
echo "These summary statistics include all currently unanswered Q&A discussions (openend at any point in the past)." \
323-
>> report.md
322+
>> summary_report.md
324323
# remove full discussions list from stats; we only want the summary
325324
tail --lines=+2 discussion_qna_open.md \
326325
| awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' \
327-
>> report.md
326+
>> summary_report.md
328327
329-
echo -e "\n### Summary of all answered Questions" >> report.md
328+
echo -e "\n### Summary of all answered Questions" >> summary_report.md
330329
echo -e "\nThese Q&A discussions were openend and also answered between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
331-
>> report.md
330+
>> summary_report.md
332331
echo -e "(Discussions search is somewhat limited on Github; there's currently no way to search for discussions answered within a given timespan)" \
333-
>> report.md
332+
>> summary_report.md
334333
# remove full discussions list from stats; we only want the summary
335334
tail --lines=+2 discussion_qna_closed.md \
336335
| awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' \
337-
>> report.md
336+
>> summary_report.md
338337
339-
echo -e "\n### New Questions" >> report.md
338+
echo -e "\n### New Questions" >> summary_report.md
340339
echo -e "\nThese Q&A discussions were created between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
341-
>> report.md
342-
tail --lines=+2 discussion_qna_opened.md >> report.md
340+
>> summary_report.md
341+
tail --lines=+2 discussion_qna_opened.md >> summary_report.md
343342
344343
345-
echo -e '\n<h2 id="discussions-metrics-other">Other Discussions</h2>' >> report.md
346-
echo -e "\n### Summary of open Discussions" >> report.md
344+
echo -e '\n<h2 id="discussions-metrics-other">Other Discussions</h2>' >> summary_report.md
345+
echo -e "\n### Summary of open Discussions" >> summary_report.md
347346
echo "These summary statistics include all currently open discussions except Q&A (openend at any point in the past)." \
348-
>> report.md
347+
>> summary_report.md
349348
# remove full discussions list from stats; we only want the summary
350349
tail --lines=+2 discussion_open.md \
351350
| awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' \
352-
>> report.md
351+
>> summary_report.md
353352
354-
echo -e "\n## New discussions" >> report.md
353+
echo -e "\n## New discussions" >> summary_report.md
355354
echo -e "\nThese discussions (except Q&A) were created between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
356-
>> report.md
357-
tail --lines=+2 discussion_opened.md >> report.md
355+
>> summary_report.md
356+
tail --lines=+2 discussion_opened.md >> summary_report.md
358357
359-
echo -e "\n## Discussions closed" >> report.md
358+
echo -e "\n## Discussions closed" >> summary_report.md
360359
echo -e "\nThese discussions (except Q&A) were opened at any point in the past and closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
361-
>> report.md
362-
tail --lines=+2 discussion_closed.md >> report.md
360+
>> summary_report.md
361+
tail --lines=+2 discussion_closed.md >> summary_report.md
362+
363+
#
364+
# Advisories
365+
#
366+
echo -e '\n\n<h1 id="advisory-metrics">Advisory Metrics</h1>' >> summary_report.md
367+
echo -e "\n\nNote that advisories are tracked in issues, so the advisories discussed in this section also contribute to the overall issue statistics above.\n\n" \
368+
>> summary_report.md
369+
370+
echo -e '\n<h2 id="advisory-metrics-new">New Advisories</h2>' >> summary_report.md
371+
echo -e "\nThese advisories were created between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
372+
>> summary_report.md
373+
tail --lines=+2 advisories_opened.md >> summary_report.md
374+
375+
echo -e '\n<h2 id="advisory-metrics-closed">Advisories closed</h2>' >> summary_report.md
376+
echo -e "\nThese advisories were openend at any point in the past and were closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
377+
>> summary_report.md
378+
tail --lines=+2 advisories_closed.md >> summary_report.md
379+
380+
echo -e '\n<h2 id="advisory-metrics-summary">All open Advisoriess</h2>' >> summary_report.md
381+
echo "These statistics cover all open advisories (openend at any point in the past)." \
382+
>> summary_report.md
383+
tail --lines=+2 advisories_open.md >> summary_report.md
363384
364385
#
365386
# Issues
366387
#
367-
echo -e '\n\n<h1 id="issue-metrics">Issue Metrics</h1>' >> report.md
388+
echo -e '\n\n<h1 id="issue-metrics">Issue Metrics</h1>' >> summary_report.md
368389
369-
echo -e '\n<h2 id="issue-metrics-summary">Summary of all open Issues</h2>' >> report.md
390+
echo -e '\n<h2 id="issue-metrics-summary">Summary of all open Issues</h2>' >> summary_report.md
370391
echo "These summary statistics include all currently open issues (openend at any point in the past)." \
371-
>> report.md
392+
>> summary_report.md
372393
# remove full issues list from stats; we only want the summary
373394
tail --lines=+2 issues_open.md \
374395
| awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' \
375-
>> report.md
396+
>> summary_report.md
376397
377-
echo -e '\n<h2 id="issue-metrics-new">New Issues</h2>' >> report.md
398+
echo -e '\n<h2 id="issue-metrics-new">New Issues</h2>' >> summary_report.md
378399
echo -e "\nThese issues were created between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
379-
>> report.md
380-
tail --lines=+2 issues_opened.md >> report.md
400+
>> summary_report.md
401+
tail --lines=+2 issues_opened.md >> summary_report.md
381402
382-
echo -e '\n<h2 id="issue-metrics-closed">Issues closed</h2>' >> report.md
403+
echo -e '\n<h2 id="issue-metrics-closed">Issues closed</h2>' >> summary_report.md
383404
echo -e "\nThese issues were openend at any point in the past and were closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
384-
>> report.md
385-
tail --lines=+2 issues_closed.md >> report.md
405+
>> summary_report.md
406+
tail --lines=+2 issues_closed.md >> summary_report.md
386407
387408
#
388-
# Advisories
409+
# Pull Requests
389410
#
390-
echo -e '\n\n<h1 id="advisory-metrics">Advisory Metrics</h1>' >> report.md
391-
echo -e "\n\nNote that advisories are tracked in issues, so the advisories discussed in this section also contribute to the overall issue statistics above.\n\n" \
392-
>> report.md
393411
394-
echo -e '\n<h2 id="advisory-metrics-new">New Advisories</h2>' >> report.md
395-
echo -e "\nThese advisories were created between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
396-
>> report.md
397-
tail --lines=+2 advisories_opened.md >> report.md
412+
echo '# Pull request metrics' >> comment_report.md
413+
echo "(See comment below for Pull Request Metrics)" >> comment_report.md
398414
399-
echo -e '\n<h2 id="advisory-metrics-closed">Advisories closed</h2>' >> report.md
400-
echo -e "\nThese advisories were openend at any point in the past and were closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
401-
>> report.md
402-
tail --lines=+2 advisories_closed.md >> report.md
403-
404-
echo -e '\n<h2 id="advisory-metrics-summary">All open Advisoriess</h2>' >> report.md
405-
echo "These statistics cover all open advisories (openend at any point in the past)." \
406-
>> report.md
407-
tail --lines=+2 advisories_open.md >> report.md
408-
409-
#
410-
# Pull Requests
411-
#
412-
echo -e '\n\n<h1 id="pr-metrics">Pull Requests Metrics</h1>' >> report.md
415+
echo "* [Pull Requests Metrics](#pr-metrics)" >> comment_report.md
416+
echo " * [Summary of all open PRs](#pr-metrics-summary)" >> comment_report.md
417+
echo " * [New PRs](#pr-metrics-new)" >> comment_report.md
418+
echo " * [Closed PRs](#pr-metrics-closed)" >> comment_report.md
419+
echo -e '\n\n<h1 id="pr-metrics">Pull Requests Metrics</h1>' >> comment_report.md
413420
414-
echo -e '\n<h2 id="pr-metrics-summary">Summary of all open PRs</h2>' >> report.md
421+
echo -e '\n<h2 id="pr-metrics-summary">Summary of all open PRs</h2>' >> comment_report.md
415422
echo "These summary statistics include all currently open PRs (openend at any point in the past)." \
416-
>> report.md
423+
>> comment_report.md
417424
# remove full PRs list from stats; we only want the summary
418425
tail --lines=+2 prs_open.md \
419426
| awk '/^\| Title \| URL \| Author \|/{silent=1} {if (silent==0) print $0}' \
420-
>> report.md
427+
>> comment_report.md
421428
422-
echo -e '\n<h2 id="pr-metrics-new">New PRs</h2>' >> report.md
429+
echo -e '\n<h2 id="pr-metrics-new">New PRs</h2>' >> comment_report.md
423430
echo -e "\nThese PRs were created between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
424-
>> report.md
425-
tail --lines=+2 prs_opened.md >> report.md
431+
>> comment_report.md
432+
tail --lines=+2 prs_opened.md >> comment_report.md
426433
427-
echo -e '\n<h2 id="pr-metrics-closed">PRs closed</h2>' >> report.md
434+
echo -e '\n<h2 id="pr-metrics-closed">PRs closed</h2>' >> comment_report.md
428435
echo -e "\nThese PRs were openend at any point in the past and were closed between ${{ env.START_DATE }} - ${{ env.END_DATE }}." \
429-
>> report.md
430-
tail --lines=+2 prs_closed.md >> report.md
436+
>> comment_report.md
437+
tail --lines=+2 prs_closed.md >> comment_report.md
431438
432-
- name: Create issue
439+
- name: Upload merged report
440+
uses: actions/upload-artifact@v4
441+
with:
442+
retention-days: 32
443+
name: full-report
444+
path: |
445+
./summary_report.md
446+
./comment_report.md
447+
448+
- name: Create issue (1/2 of report)
449+
id: ciss
433450
uses: peter-evans/create-issue-from-file@v5
434451
with:
435452
title: Monthly contributions report ${{ env.START_DATE }} - ${{ env.END_DATE }}
436453
token: ${{ secrets.GITHUB_TOKEN }}
437-
content-filepath: ./report.md
454+
content-filepath: ./summary_report.md
438455
labels: kind/metric
456+
457+
- name: Create comment (2/2 of report)
458+
id: cisc
459+
uses: peter-evans/create-or-update-comment@v4
460+
with:
461+
token: ${{ secrets.GITHUB_TOKEN }}
462+
issue-number: ${{ steps.ciss.outputs.issue-number }}
463+
body-path: ./comment_report.md

0 commit comments

Comments
 (0)