Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/scripts/report-issue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,42 @@
#
# The body is the check's Markdown report from "$RUNNER_TEMP/report.md", or
# a note that the check stopped before writing one, plus a link to the run.
# The whole report also goes to the run's summary page. GitHub refuses an
# issue or comment body over 65,536 characters, so a longer report is cut at
# a line end below that, and the body says where the rest is.
#
# Usage (in a workflow step): TITLE=... GH_TOKEN=... .github/scripts/report-issue.sh
set -euo pipefail

: "${TITLE:?set TITLE to the issue title}"
report="${RUNNER_TEMP:?}/report.md"
body="${RUNNER_TEMP}/issue-body.md"
run="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
# Bytes, never fewer than characters, so the cut body is under GitHub's limit.
limit=60000

if [ -s "$report" ] && [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
cat "$report" >> "$GITHUB_STEP_SUMMARY"
fi

{
if [ -s "$report" ]; then
if [ ! -s "$report" ]; then
echo "The check stopped before writing a report, for example on a network error."
elif [ "$(wc -c < "$report")" -le "$limit" ]; then
cat "$report"
else
echo "The check stopped before writing a report, for example on a network error."
# The last line is dropped, since the cut may fall inside it.
head -c "$limit" "$report" | sed '$d'
echo
echo "The report is longer than an issue can hold, so it stops here. The whole report is on the run's summary page."
fi
echo
echo "Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
echo "Run: $run"
} > "$body"

# gh's --search is fuzzy, so match the exact title before reusing an issue.
number="$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
# gh's --search is fuzzy, so match the exact title before reusing an issue. Only an issue
# this workflow opened is reused, so anyone who opens one with the same title first is ignored.
number="$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --author app/github-actions \
--search "in:title \"$TITLE\"" --json number,title \
--jq 'map(select(.title == env.TITLE)) | .[0].number // empty')"

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The `v0.0.0` tag is a baseline, not a release: it marks where versioning starts

## [Unreleased]

### Fixed

- **An upstream-watch report too long for an issue is cut below GitHub's limit, and the whole report goes on the run's summary page.**

### Changed

- **The sidecar copies and the skills pin are at Knowledge Trust Ladder [v0.71.0](https://github.com/noelmcloughlin/knowledge-trust-ladder/compare/v0.66.0...v0.71.0).** The release changed `.github/workflows/knowledge-registrar.yaml`, `.github/workflows/knowledge-librarian.yaml`, `.github/workflows/knowledge-release.yaml`, `.github/workflows/knowledge-sync.yaml`, `.github/PULL_REQUEST_TEMPLATE/knowledge-sync.md`, `.lokf/scripts/knowledge-conventions.sh`, `.lokf/scripts/knowledge-conventions.py`, `.lokf/scripts/knowledge-preflight.sh`, `.lokf/scripts/knowledge-provenance.sh`, `.lokf/scripts/knowledge-feedback.sh`, `.lokf/scripts/knowledge-apply.py`, `.lokf/scripts/knowledge-report.sh`, `.lokf/scripts/knowledge-sync.sh`, `.lokf/m365/ktl-docent-m365.md`, `.lokf/justfile`, `website/assets/css/site.css`, `website/assets/js/graph.js`, `website/assets/js/site.js`, `website/content/_content.gotmpl`, `website/content/knowledge/_content.gotmpl`, `website/.gitignore`, `website/hugo.toml`, `website/layouts/_markup/render-blockquote.html`, `website/layouts/_markup/render-codeblock-mermaid.html`, `website/layouts/_markup/render-heading.html`, `website/layouts/_markup/render-link.html`, `website/layouts/_partials/gendoc.html`, `website/layouts/_partials/heroes.html`, `website/layouts/_partials/icon.html`, `website/layouts/_partials/markdown-file.html`, `website/layouts/_partials/nav-key.html`, `website/layouts/_partials/route.html`, `website/layouts/_partials/schema-file.html`, `website/layouts/_partials/sidebar.html`, `website/layouts/_partials/tools.html`, `website/layouts/_partials/vendor.html`, `website/layouts/baseof.html`, `website/layouts/health.html`, `website/layouts/home.badge.json`, `website/layouts/home.llms.txt`, `website/layouts/page.atom.xml`, `website/layouts/page.html`, `website/layouts/schema/section.html`, `website/pyproject.toml`, `website/scripts/build.sh`, `website/scripts/clean-html.py`, `website/scripts/prepare.sh`, `website/uv.lock`, `.github/workflows/knowledge-website.yaml`, `website/layouts/_partials/own.html`, `website/layouts/_partials/spec.html`, `website/scripts/check-svg.py`, `website/scripts/lokf-export.py`, `website/scripts/site-values.py`, `website/scripts/uv-env.sh` and `website/scripts/vendor.sh` here.
Expand Down
Loading