https://github.com/antoncoding/gas-diff-action
Compares gas usage in Solidity projects using Foundry and comments the changes on the PR
https://github.com/antoncoding/gas-diff-action
Last synced: 11 months ago
JSON representation
Compares gas usage in Solidity projects using Foundry and comments the changes on the PR
- Host: GitHub
- URL: https://github.com/antoncoding/gas-diff-action
- Owner: antoncoding
- Created: 2023-04-30T06:38:06.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-07T05:18:00.000Z (over 1 year ago)
- Last Synced: 2025-03-17T00:48:09.171Z (12 months ago)
- Language: Rust
- Size: 425 KB
- Stars: 23
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gas Diff Action
Gas Diff Action is a GitHub Action that compares gas usage in Solidity projects using Foundry and comments the changes on the PR.
## Preview

## Usage
To integrate Gas Diff Action into your project, follow these steps:
1. Create a `.github/workflows` directory in your repository if it doesn't already exist.
2. Inside the `workflows` directory, create a new file called `gas_comparison.yml`.
3. Add the following content to the `gas_comparison.yml` file:
```yaml
name: Gas Comparison
on:
pull_request:
types:
- opened
- synchronize
# Set the job-level permissions
permissions:
pull-requests: write
contents: read
jobs:
gas_comparison:
runs-on: ubuntu-latest
steps:
- name: Run Gas Comparison
uses: antoncoding/gas-diff-action@v2.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
base_ref: ${{ github.base_ref }}
head_ref: ${{ github.head_ref }}
```
## Debugging
If you encounter issues with the action, particularly related to permissions, follow these steps:
1. Ensure that the `permissions` key is correctly set in your workflow file as shown in the example above.
2. If you're still having issues, check the permissions of the GitHub token:
- Go to your repository's Settings
- Navigate to Actions > General
- Scroll down to "Workflow permissions"
- Ensure that "Read and write permissions" is selected for the GITHUB_TOKEN
3. Make sure your workflow file is correctly configured and the `token` input is properly set to `${{ secrets.GITHUB_TOKEN }}`.
If problems persist, please open an issue in the Gas Diff Action repository with details about the error and your configuration.
## Contributing
Contributions to Gas Diff Action are welcome! Please submit issues for bug reports or feature requests and create pull requests for any improvements or bug fixes.
## License
Gas Diff Action is released under the MIT License.