GitHub Actions job summaries#
New feature announced here. Here’s the full documentation.
These are incredibly easy to use. GitHub creates a file in your workspace and puts the filename in $GITHUB_STEP_SUMMARY
, so you can build the summary markdown over multiple steps like this:
1echo "{markdown content}" >> $GITHUB_STEP_SUMMARY
I decided to try this out in my simonw/pypi-datasette-packages repo, which runs a daily Git scraper that records a copy of the PyPI JSON for packages within the Datasette ecosystem.
I ended up mixing it with the Git commit code, so the step now looks like this:
1 - name: Commit and push2 run: |-3 git config user.name "Automated"4 git config user.email "actions@users.noreply.github.com"5 git add -A6 timestamp=$(date -u)7 git commit -m "${timestamp}" || exit 08 echo '### Changed files' >> $GITHUB_STEP_SUMMARY9 echo '```' >> $GITHUB_STEP_SUMMARY10 git show --name-only --format=tformat: >> $GITHUB_STEP_SUMMARY11 echo '```' >> $GITHUB_STEP_SUMMARY12 git pull --rebase13 git push
This produces a summary that looks like this:

Two things I had to figure out here. First, the backtick needs escaping if used in double quotes but does not in single quotes:
1echo '```' >> $GITHUB_STEP_SUMMARY
I wanted to show just the list of affected filenames from the most recent Git commit. That’s what this does:
1git show --name-only --format=tformat:
Without the --format=tformat
bit this shows the full commit message and header in addition to the list of files.
I’m running this in the same block as the other git
commands so that this line will terminate the step early without writing to the summary file if there are no changes to be committed:
1git commit -m "${timestamp}" || exit 0