Skip to content

feat(frontend): integration of Solana #720

feat(frontend): integration of Solana

feat(frontend): integration of Solana #720

name: Formatting Backend and Scripts
on:
pull_request:
paths:
- # Files formatted by ./scripts/format.cargo.sh
'**/Cargo.toml'
- # Files formatted by ./scripts/format.rust.sh
'**/*.rs'
- # Files formatted by ./scripts/format.sh.sh
# Note: shell scripts not ending in .sh are found with: scripts/format.sh.sh --list | grep -vE 'sh$'
'**/*.sh'
- 'docker/*'
- 'scripts/*'
- # This workflow
'.github/workflows/formatting-checks.yml'
workflow_dispatch:
jobs:
format:
runs-on: ubuntu-24.04
steps:
- name: Check if commits can be added
id: check_can_add_commit
run: |
echo "can_add_commit=${{ secrets.GIX_CREATE_PR_PAT != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT
- name: Checkout code
if: steps.check_can_add_commit.outputs.can_add_commit == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GIX_CREATE_PR_PAT }}
- name: Checkout code
if: steps.check_can_add_commit.outputs.can_add_commit == 'false'
uses: actions/checkout@v4
- name: Install shfmt
run: sudo snap install --classic shfmt
- name: Install binstall
run: |
BINSTALL_VERSION="1.8.0"
curl -L --proto '=https' --tlsv1.2 -sSf "https://github.com/cargo-bins/cargo-binstall/releases/download/v${BINSTALL_VERSION}/cargo-binstall-x86_64-unknown-linux-musl.tgz" | tar -xvzf - cargo-binstall
./cargo-binstall -y --force "cargo-binstall@$BINSTALL_VERSION"
rm cargo-binstall
- name: Install cargo dependency sorter
run: cargo binstall --no-confirm cargo-sort@1.0.9
- name: Format
run: ./scripts/format.sh
- name: Check formatted
id: check_changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
else
echo "changes_detected=false" >> $GITHUB_OUTPUT
fi
- name: Commit format
if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_changes.outputs.changes_detected == 'true'
uses: EndBug/add-and-commit@v9
with:
add: .
default_author: github_actions
message: '🤖 Apply formatting changes'
- name: Provide diff
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_changes.outputs.changes_detected == 'true'
run: |
echo "FIX: Please run ./scripts/format.sh"
git diff
exit 1