Skip to content

Commit

Permalink
feat: add snapshot diffing
Browse files Browse the repository at this point in the history
  • Loading branch information
boredland committed Jan 29, 2025
1 parent cdd2cce commit 072eb3d
Show file tree
Hide file tree
Showing 19 changed files with 2,520 additions and 24,990 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2

- uses: bgd-labs/github-workflows/.github/actions/setup-node@main

- name: test lib
run: npm test -- --run

- name: test action
id: gas
uses: ./
with:
ROOT_REPORT_PATH: "mocks/gas.backup.json"
REPORT_PATH: "mocks/gas.json"
token: ${{ secrets.GITHUB_TOKEN }}
heading: "Gas report"
baseBranch: "main"
files: |
mocks/*.json
- name: Prepare comment
run: |
printf '%s' "${{ steps.gas.outputs.gas-report }}" > /tmp/template.md
printf '%s' "${{ steps.gas.outputs.report }}" > /tmp/template.md
- name: Find Comment
uses: peter-evans/find-comment@v3
Expand Down
24 changes: 15 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: "foundry-gas-report"
description: "Generates a html gas report diffing two json gas-report files"
description: "Generates a report about differences between two JSON files."
inputs:
ROOT_REPORT_PATH:
description: "The path to the gas report to diff against. If empty it will not diff, but just pretty print the report."
heading:
description: "The heading to use for the report."
required: false
REPORT_PATH:
description: "The path to the gas report."
default: "Gas report"
token:
description: "The GitHub token to use for the API requests."
required: true
ignoreUnchanged:
description: "If true, the diff will ignore unchanged items."
files:
description: "The files that should be compared. A glob is accepted."
required: false
default: "false"
default: |
snapshots/*.json
baseBranch:
description: "The base branch to compare against."
required: false
default: "main"

outputs:
report:
description: "The html gas report"
description: "The report"

runs:
using: "node20"
Expand Down
2 changes: 0 additions & 2 deletions dist/action.d.mts

This file was deleted.

Loading

0 comments on commit 072eb3d

Please sign in to comment.