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 1476ff4
Show file tree
Hide file tree
Showing 18 changed files with 4,426 additions and 945 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@ 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 }}
files: |
package.json
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
22 changes: 12 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
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."
required: false
REPORT_PATH:
description: "The path to the 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: |
snapshots/*.json
baseBranch:
description: "The base branch to compare against."
required: false
default: "false"
default: "main"

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

runs:
using: "node20"
Expand Down
Loading

0 comments on commit 1476ff4

Please sign in to comment.