From e729dfd8910dfcd16cc11f4c78c6e869da60b896 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Thu, 16 Jul 2026 14:13:39 +0200 Subject: [PATCH] fix(ci): prevent autofix race --- .github/workflows/autofix.yml | 35 +++++++++-------------------------- package.json | 2 +- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 44ca433cb..7c4c79d3c 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -1,4 +1,4 @@ -name: Auto-fix lint and format +name: Formatting on: pull_request: @@ -6,47 +6,30 @@ on: branches: ["*"] permissions: - contents: write + contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} cancel-in-progress: true jobs: - autofix: - name: Auto-fix - if: github.event.pull_request.head.repo.id == github.repository_id + format: + name: Check formatting runs-on: ubuntu-latest timeout-minutes: 5 steps: - uses: actions/checkout@v7 with: fetch-depth: 0 - ref: ${{ github.head_ref }} + persist-credentials: false - name: Setup uses: ./tooling/github/setup - - name: Get changed files - id: changed + - name: Check changed files env: BASE_REF: ${{ github.base_ref }} run: | - git diff --name-only --diff-filter=ACMR "origin/${BASE_REF}...HEAD" -- '*.ts' '*.tsx' '*.js' '*.jsx' > /tmp/changed-files - echo "count=$(wc -l < /tmp/changed-files | tr -d '[:space:]')" >> $GITHUB_OUTPUT - - - name: Auto-fix lint + format - if: steps.changed.outputs.count != '0' - run: | - xargs -r -a /tmp/changed-files pnpm exec oxlint --fix || true - xargs -r -a /tmp/changed-files pnpm exec oxfmt --write - - - name: Format all files in affected workspaces - if: steps.changed.outputs.count != '0' - run: | - pnpm turbo run format --continue - - - name: Commit fixes - uses: stefanzweifel/git-auto-commit-action@v7 - with: - commit_message: "style: auto-fix lint and format [skip ci]" + git diff --name-only --diff-filter=ACMR -z "origin/${BASE_REF}...HEAD" -- \ + '*.css' '*.js' '*.json' '*.jsonc' '*.jsx' '*.md' '*.mdx' '*.scss' '*.ts' '*.tsx' '*.yaml' '*.yml' \ + | xargs -0 -r pnpm exec oxfmt --check diff --git a/package.json b/package.json index 57ba58929..61347b5dc 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "build": "cross-env CI=true turbo build", "clean": "git clean -xdf node_modules", "clean:workspaces": "turbo clean", -"check:custom-widgets": "pnpm --filter @homarr/custom-widgets check:architecture", + "check:custom-widgets": "pnpm --filter @homarr/custom-widgets check:architecture", "check:custom-widget-bundle": "node ./scripts/check-custom-widget-bundle.mjs", "ci:act:all": "bash scripts/ci/act.sh all", "ci:act:cleanup": "bash scripts/ci/act.sh cleanup",