nix-flake-outputs-size/action.yml
Jalil David Salamé Messina 46291fc850
feat!(report): generate JSON instead of markdown
This allows us to analyze the report more easily. There is experimental
support for comparing against a base report, but we don't expose that
functionality to the action.
2024-12-17 23:17:48 +01:00

48 lines
1.4 KiB
YAML

name: 'Nix Flake Outputs Size Report'
author: Jalil David Salamé Messina
description: |
Use `nix path-info` to query the size of flake outputs and produce a markdown
report.
You can post this report as a comment to the PR associated with the current
branch and/or export the report as a markdown artifact.
Requires `nix`, `jq`, `curl`, `sed` and `coreutils` to be in path.
Usage:
```yaml
- name: Generate size report
uses: https://git.salame.cl/jalil/nix-flake-outputs-size@main
with: # Default values
comment-on-pr: 'true'
generate-artifact: 'false'
artifact-name: 'size-report.md'
```
inputs:
comment-on-pr:
description: Comment the report on the PR associated with the current branch.
default: 'true'
generate-artifact:
description: Export the generated markdown document as an artifact.
default: 'false'
artifact-name:
description: The name of the generated artifact.
default: report.json
outputs:
runs:
using: 'composite'
steps:
- name: Create report
run: |
"$GITHUB_ACTION_PATH/create-report.sh" > report.json
- name: Upload Artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
if: inputs.generate-artifact == 'true'
with:
path: report.json
name: ${{ inputs.artifact-name }}
- name: Comment Report
if: inputs.comment-on-pr == 'true'
run: |
"$GITHUB_ACTION_PATH/comment_on_pr.sh" report.json