aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-01-16 09:26:30 +0800
committerGitHub <noreply@github.com>2026-01-16 09:26:30 +0800
commit36138be8e858cb35845014421aeaa7fa6a426217 (patch)
tree86cb343006fd22a1ead57d66285fdc152aae0e10
parent73e83b4cb5b1adcd0463fc32d558d71a391b9264 (diff)
downloadDropOut-36138be8e858cb35845014421aeaa7fa6a426217.tar.gz
DropOut-36138be8e858cb35845014421aeaa7fa6a426217.zip
refactor(ci): Refactor lint workflow for auto fixes on push
Updated the lint workflow to automatically fix issues on push to main or dev branches. Changed the checkout action version and adjusted the commit message for auto commits.
-rw-r--r--.github/workflows/lint.yml83
1 files changed, 17 insertions, 66 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index c8d1b27..5188f4e 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,62 +1,35 @@
-name: UI Linter
+name: UI Auto Fix
on:
- workflow_run:
- workflows: ["UI Checker"]
- types:
- - completed
+ push:
+ branches: ["main", "dev"]
+ paths:
+ - "ui/**"
workflow_dispatch:
- inputs:
- commit_message:
- description: "Commit Message"
- type: string
- required: false
jobs:
- check:
- if: |
- (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
- github.event_name == 'workflow_dispatch'
+ fix:
+ if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- - name: Check if it is a direct push
- id: check_push
- run: |
- if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
- if [[ "${{ github.event.workflow_run.event }}" == "pull_request" ]]; then
- echo "PR detected. Exiting."
- echo "is_pr=True" >> $GITHUB_OUTPUT
- else
- echo "Direct push or other event detected. Proceeding..."
- echo "is_pr=False" >> $GITHUB_OUTPUT
- fi
- else
- echo "Manual trigger detected. Proceeding..."
- echo "is_pr=False" >> $GITHUB_OUTPUT
- fi
-
- - name: Checkout repository
- if: steps.check_push.outputs.is_pr != 'True'
- uses: actions/checkout@v6
+ - uses: actions/checkout@v4
with:
- show-progress: false
- persist-credentials: false
-
+ token: ${{ secrets.GITHUB_TOKEN }}
+
- name: Install pnpm
- if: steps.check_push.outputs.is_pr != 'True'
uses: pnpm/action-setup@v4
with:
version: 9
- run_install: true
- package_json_file: ui/package.json
- name: Install Node.js
- if: steps.check_push.outputs.is_pr != 'True'
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- cache-dependency-path: ui/pnpm-lock.yaml
+ cache-dependency-path: "ui/pnpm-lock.yaml"
+
+ - run: pnpm install
+ working-directory: ui
- run: pnpm format
working-directory: ui
@@ -65,29 +38,7 @@ jobs:
working-directory: ui
- name: Commit changes
- id: commit_changes
- if: steps.check_push.outputs.is_pr != 'True'
- run: |
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
-
- git add .
-
- if git diff-index --quiet HEAD --; then
- echo "No changes to commit"
- else
- commit_msg="${{ github.event.inputs.commit_message }}"
- if [ -z "$commit_msg" ]; then
- commit_msg="chore: Auto Templates Optimization"
- fi
- git commit -m "$commit_msg" -m "Triggered by ${{github.sha}}" -m "[skip changelog]"
- git pull origin $(git rev-parse --abbrev-ref HEAD) --unshallow --rebase
- echo "have_commits=True" >> $GITHUB_OUTPUT
- fi
-
- - name: Push changes
- if: steps.check_push.outputs.is_pr != 'True' && steps.commit_changes.outputs.have_commits == 'True' && github.repository_owner == 'MAA1999'
- uses: ad-m/github-push-action@master
+ uses: stefanzweifel/git-auto-commit-action@v5
with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- branch: ${{ github.ref }}
+ commit_message: "style: auto format and lint fix [skip ci]"
+ file_pattern: "ui/**"