Merge pull request #40 from PatrickAlphaC/feat/v3 #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Format Solidity | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "registry-contracts/**/*.sol" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "registry-contracts/**/*.sol" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| format: | |
| name: Format Solidity files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Run forge fmt | |
| run: forge fmt | |
| working-directory: registry-contracts | |
| - name: Check for changes | |
| id: verify-changed-files | |
| run: | | |
| if [ -n "$(git status --porcelain registry-contracts)" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit formatted files | |
| if: steps.verify-changed-files.outputs.changed == 'true' | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: forge-fmt[bot] | |
| author_email: forge-fmt[bot]@users.noreply.github.com | |
| message: "style: auto-format Solidity files with forge fmt" | |
| add: "registry-contracts/**/*.sol" | |
| push: true |