Skip to content

check and update two slots #11

check and update two slots

check and update two slots #11

Workflow file for this run

name: Gas Report
on:
pull_request:
branches:
- dev
- main
jobs:
generate-gas-report:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/yarn
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
- name: Run gas report script
run: node scripts/foundry/generateGasReport.js
- name: Check gas report file exists
run: |
if [ ! -f GAS_REPORT.md ]; then
echo "GAS_REPORT.md does not exist."
exit 1
fi
- name: Upload gas report artifact
uses: actions/upload-artifact@v4
with:
name: gas-report-${{ github.sha }}
path: GAS_REPORT.md
if-no-files-found: warn
compare-gas-report:
runs-on: ubuntu-latest
needs: generate-gas-report
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download previous gas report
id: download-previous
uses: actions/download-artifact@v4
with:
name: gas-report-${{ github.event.pull_request.base.sha }}
path: previous_gas_report
continue-on-error: true
- name: Download current gas report
uses: actions/download-artifact@v4
with:
name: gas-report-${{ github.sha }}
path: current_gas_report
- name: Compare gas reports
id: compare-gas-reports
if: steps.download-previous.outcome == 'success'
run: |
node scripts/foundry/compareGasReports.js previous_gas_report/GAS_REPORT.md current_gas_report/GAS_REPORT.md > gas_report_diff.md
- name: Handle no previous report
if: steps.download-previous.outcome != 'success'
run: echo "No previous gas report found. Skipping comparison."
- name: Upload gas report comparison
if: steps.compare-gas-reports.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: gas-report-comparison-${{ github.sha }}
path: gas_report_diff.md
- name: Read gas report comparison
if: steps.compare-gas-reports.outcome == 'success'
id: read-gas-report-comparison
run: echo "gas_report_diff=$(<gas_report_diff.md)" >> $GITHUB_ENV
- name: Create pull request comment
if: steps.compare-gas-reports.outcome == 'success'
uses: marocchino/sticky-pull-request-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
header: Gas Report Comparison
message: |
## Gas Report Comparison
```diff
${{ env.gas_report_diff }}
```