fix(ci): prevent autofix race
This commit is contained in:
2 files changed
+10
-27
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
name: Auto-fix lint and format
|
name: Formatting
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -6,47 +6,30 @@ on:
|
|||||||
branches: ["*"]
|
branches: ["*"]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
autofix:
|
format:
|
||||||
name: Auto-fix
|
name: Check formatting
|
||||||
if: github.event.pull_request.head.repo.id == github.repository_id
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ github.head_ref }}
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Setup
|
- name: Setup
|
||||||
uses: ./tooling/github/setup
|
uses: ./tooling/github/setup
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Check changed files
|
||||||
id: changed
|
|
||||||
env:
|
env:
|
||||||
BASE_REF: ${{ github.base_ref }}
|
BASE_REF: ${{ github.base_ref }}
|
||||||
run: |
|
run: |
|
||||||
git diff --name-only --diff-filter=ACMR "origin/${BASE_REF}...HEAD" -- '*.ts' '*.tsx' '*.js' '*.jsx' > /tmp/changed-files
|
git diff --name-only --diff-filter=ACMR -z "origin/${BASE_REF}...HEAD" -- \
|
||||||
echo "count=$(wc -l < /tmp/changed-files | tr -d '[:space:]')" >> $GITHUB_OUTPUT
|
'*.css' '*.js' '*.json' '*.jsonc' '*.jsx' '*.md' '*.mdx' '*.scss' '*.ts' '*.tsx' '*.yaml' '*.yml' \
|
||||||
|
| xargs -0 -r pnpm exec oxfmt --check
|
||||||
- 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]"
|
|
||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
"build": "cross-env CI=true turbo build",
|
"build": "cross-env CI=true turbo build",
|
||||||
"clean": "git clean -xdf node_modules",
|
"clean": "git clean -xdf node_modules",
|
||||||
"clean:workspaces": "turbo clean",
|
"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",
|
"check:custom-widget-bundle": "node ./scripts/check-custom-widget-bundle.mjs",
|
||||||
"ci:act:all": "bash scripts/ci/act.sh all",
|
"ci:act:all": "bash scripts/ci/act.sh all",
|
||||||
"ci:act:cleanup": "bash scripts/ci/act.sh cleanup",
|
"ci:act:cleanup": "bash scripts/ci/act.sh cleanup",
|
||||||
|
|||||||
Reference in new issue
Block a user