From 64958062cb278002f47cf1c5d508a8e5438e8401 Mon Sep 17 00:00:00 2001 From: Igor Sudak Date: Mon, 15 Apr 2024 16:20:15 +0200 Subject: [PATCH] GH workflow: don't post linter reports if they are > 54KB (#56) --- .github/workflows/preflight-summary.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preflight-summary.yml b/.github/workflows/preflight-summary.yml index ad62640..e020513 100644 --- a/.github/workflows/preflight-summary.yml +++ b/.github/workflows/preflight-summary.yml @@ -52,14 +52,21 @@ jobs: cat test-summary.md printf "\n\n### Code Coverage Summary\n" cat code-coverage-results.md - JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/${{ github.event.workflow_run.id }}" - printf "\nView full reports on the [Job Summary]($JOB_URL \"Go to Job Summary\") page\n\n" + printf "\n" cat {pylint,black,isort,bandit}-report.md > linter-reports.md 2>/dev/null || true if [[ -s linter-reports.md ]]; then printf "### Linter reports\n" - cat linter-reports.md + # Max size of comments on GitHub is 64KB. If the reports > 54KB, don't post them + if [[ $(stat --format=%s linter-reports.md) -gt 55296 ]]; then + printf "The reports are too big to be posted here.\n" + else + cat linter-reports.md + fi fi + + JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/${{ github.event.workflow_run.id }}" + printf "View full reports on the [Job Summary]($JOB_URL \"Go to Job Summary\") page.\n" } > preflight-report.md - name: Comment PR