Skip to content

feat(ci): add forge fmt and solhint jobs #6

feat(ci): add forge fmt and solhint jobs

feat(ci): add forge fmt and solhint jobs #6

Workflow file for this run

name: Format using `forge fmt`
on:
pull_request:
push:
branches:
- main
- release/**
tags:
- "*"
env:
FOUNDRY_PROFILE: ci
jobs:
check:
strategy:
fail-fast: true
name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
# replace nightly because latest nightly release has some breaking changes that result in test failures
# this is a previous recent nightly release that should work
version: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Run Forge Formatter
run: |
forge fmt --check
id: fmt
- name: Add comment on failure
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'The code is not formatted correctly. Please run `forge fmt` and push the changes.'
})