aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-01-18 12:24:29 +0800
committerGitHub <noreply@github.com>2026-01-18 12:24:29 +0800
commitfd00ac6878b2cee9337b9e92d0c990ecdce9a346 (patch)
treebb5540f763dc0061877c9d9ac53747d79193eecc /.github/workflows
parentad36e0ce82770f9b3509ddb1cf96bc3422969806 (diff)
parent6d82ab2275130f3bafdb7ec664297eb700321526 (diff)
downloadDropOut-fd00ac6878b2cee9337b9e92d0c990ecdce9a346.tar.gz
DropOut-fd00ac6878b2cee9337b9e92d0c990ecdce9a346.zip
Merge pull request #58 from HsiangNianian/main
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/check.yml4
-rw-r--r--.github/workflows/issue-checkbox-checker.yml104
-rw-r--r--.github/workflows/prek.yml60
-rw-r--r--.github/workflows/stale.yml92
-rw-r--r--.github/workflows/test.yml72
5 files changed, 328 insertions, 4 deletions
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 58fc378..ba8ce54 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -13,6 +13,8 @@ on:
jobs:
check:
+ permissions:
+ contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -38,6 +40,6 @@ jobs:
- run: pnpm lint
working-directory: ui
- - run: pnpm format --check
+ - run: pnpm format
working-directory: ui
diff --git a/.github/workflows/issue-checkbox-checker.yml b/.github/workflows/issue-checkbox-checker.yml
new file mode 100644
index 0000000..ce7e011
--- /dev/null
+++ b/.github/workflows/issue-checkbox-checker.yml
@@ -0,0 +1,104 @@
+name: Issue Checkbox Checker
+
+on:
+ issues:
+ types: [opened, edited]
+
+permissions:
+ issues: write
+
+jobs:
+ check-checkboxes:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check for unchecked prerequisites
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const issue = context.payload.issue;
+ if (!issue) return;
+
+ const body = issue.body || '';
+
+ // Check if "I have not read carefully" checkbox is checked
+ const notReadPatterns = [
+ /- \[[xX]\] I have not read carefully/,
+ /- \[[xX]\] 我未仔细阅读/
+ ];
+
+ const hasNotReadChecked = notReadPatterns.some(pattern => pattern.test(body));
+
+ if (hasNotReadChecked) {
+ const closeMessage = [
+ '## Issue Automatically Closed / Issue 已自动关闭',
+ '',
+ '**English:**',
+ 'This issue has been automatically closed because you checked "I have not read carefully."',
+ '',
+ 'Please:',
+ '1. Read the [README](https://github.com/' + context.repo.owner + '/' + context.repo.repo + '/blob/main/README.md) and documentation carefully',
+ '2. Search for existing issues',
+ '3. Fill out the issue template completely',
+ '4. Submit a new issue when ready',
+ '',
+ '**中文:**',
+ '此 Issue 已被自动关闭,因为您勾选了"我未仔细阅读"。',
+ '',
+ '请:',
+ '1. 仔细阅读 [README](https://github.com/' + context.repo.owner + '/' + context.repo.repo + '/blob/main/README.md) 和文档',
+ '2. 搜索现有 Issue',
+ '3. 完整填写 Issue 模板',
+ '4. 准备好后提交新的 Issue',
+ '',
+ '---',
+ '*This is an automated action. If you believe this was done in error, please contact the maintainers.*'
+ ].join('\n');
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ body: closeMessage
+ });
+
+ await github.rest.issues.update({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ state: 'closed',
+ state_reason: 'not_planned'
+ });
+
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ labels: ['invalid', 'auto-closed']
+ });
+
+ return;
+ }
+
+ // Count total checkboxes and checked boxes
+ const totalBoxes = (body.match(/- \[[ xX]\]/g) || []).length;
+ const checkedBoxes = (body.match(/- \[[xX]\]/g) || []).length;
+
+ // If no boxes are checked in prerequisites, add a reminder
+ if (totalBoxes > 0 && checkedBoxes === 0) {
+ const reminderMessage = [
+ '## Reminder / 提醒',
+ '',
+ '**English:**',
+ 'Please check the prerequisite boxes in the issue template to confirm you have completed the required steps.',
+ '',
+ '**中文:**',
+ '请勾选 Issue 模板中的前置条件复选框,以确认您已完成必要步骤。'
+ ].join('\n');
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ body: reminderMessage
+ });
+ }
diff --git a/.github/workflows/prek.yml b/.github/workflows/prek.yml
new file mode 100644
index 0000000..8e43763
--- /dev/null
+++ b/.github/workflows/prek.yml
@@ -0,0 +1,60 @@
+name: Prek Checks
+
+on:
+ push:
+ branches: ["main", "dev"]
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+jobs:
+ prek:
+ runs-on: ubuntu-latest
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ fetch-depth: 0
+
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@stable
+
+ - name: Install system dependencies
+ if: runner.os == 'Linux'
+ run: |
+ sudo apt-get update || true
+ sudo apt-get install -y \
+ libwebkit2gtk-4.1-dev \
+ build-essential \
+ libssl-dev \
+ libgtk-3-dev \
+ libayatana-appindicator3-dev \
+ librsvg2-dev \
+ pkg-config
+
+ - name: Run prek
+ id: prek
+ uses: j178/prek-action@v1
+ continue-on-error: true
+
+ - name: Check for changes
+ id: check_changes
+ if: steps.prek.outcome == 'failure'
+ run: |
+ if [ -n "$(git status --porcelain)" ]; then
+ echo "has_changes=true" >> $GITHUB_OUTPUT
+ else
+ echo "has_changes=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Commit fixes
+ if: steps.prek.outcome == 'failure' && steps.check_changes.outputs.has_changes == 'true'
+ uses: stefanzweifel/git-auto-commit-action@v5
+ with:
+ commit_message: "chore: apply prek auto-fixes [skip ci]"
+ commit_user_name: "hydroroll-bot"
+ commit_user_email: "bot@hydroroll.team"
+ skip_dirty_check: true
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..4005b2c
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,92 @@
+name: 'Close stale issues'
+
+on:
+ schedule:
+ - cron: '0 0 * * *' # Run daily at midnight UTC
+ workflow_dispatch:
+
+permissions:
+ issues: write
+ pull-requests: write
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v9
+ with:
+ # Issues
+ days-before-issue-stale: 90
+ days-before-issue-close: 7
+ stale-issue-label: 'stale'
+ exempt-issue-labels: 'pinned,enhancement,documentation'
+ stale-issue-message: |
+ ## This issue has been automatically marked as stale
+ ## 此 Issue 已被自动标记为过期
+
+ **English:**
+ This issue has had no activity for 90 days and will be closed in 7 days if no further activity occurs.
+
+ If this issue is still relevant:
+ - Comment with an update
+ - Provide additional information
+ - Confirm you're still experiencing the problem
+
+ **中文:**
+ 此 Issue 已 90 天无活动,如果继续无活动将在 7 天后关闭。
+
+ 如果此问题仍然相关:
+ - 发表评论更新状态
+ - 提供额外信息
+ - 确认您仍在遇到该问题
+
+ ---
+ *This is an automated message. To prevent closure, simply comment on this issue.*
+ close-issue-message: |
+ ## This issue has been automatically closed
+ ## 此 Issue 已被自动关闭
+
+ **English:**
+ This issue was automatically closed due to inactivity. If you're still experiencing this problem, please open a new issue with updated information.
+
+ **中文:**
+ 此 Issue 因无活动而被自动关闭。如果您仍然遇到此问题,请开启一个新的 Issue 并提供最新信息。
+
+ # Pull Requests
+ days-before-pr-stale: 60
+ days-before-pr-close: 14
+ stale-pr-label: 'stale'
+ exempt-pr-labels: 'pinned,security'
+ stale-pr-message: |
+ ## This pull request has been automatically marked as stale
+ ## 此 PR 已被自动标记为过期
+
+ **English:**
+ This pull request has had no activity for 60 days and will be closed in 14 days if no further activity occurs.
+
+ If you're still working on this:
+ - Push new commits
+ - Comment with a status update
+ - Request a review
+
+ **中文:**
+ 此 PR 已 60 天无活动,如果继续无活动将在 14 天后关闭。
+
+ 如果您仍在处理此问题:
+ - 推送新的提交
+ - 发表评论更新状态
+ - 请求审查
+ close-pr-message: |
+ ## This pull request has been automatically closed
+ ## 此 PR 已被自动关闭
+
+ **English:**
+ This pull request was automatically closed due to inactivity. Feel free to reopen if you resume work on this.
+
+ **中文:**
+ 此 PR 因无活动而被自动关闭。如果您恢复工作,请随时重新开启。
+
+ # General settings
+ operations-per-run: 100
+ remove-stale-when-updated: true
+ ascending: true
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 8ca056e..8bf6d2f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -10,6 +10,9 @@ on:
branches: ["main"]
workflow_dispatch:
+permissions:
+ contents: read
+
env:
CARGO_TERM_COLOR: always
@@ -42,8 +45,8 @@ jobs:
- name: Install Dependencies (Ubuntu)
if: runner.os == 'Linux' && !matrix.wayland
run: |
- sudo apt-get update
- sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
+ sudo apt-get update || true
+ sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2
- name: Install Dependencies (Arch Linux)
if: matrix.wayland
@@ -62,6 +65,27 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
+ - name: Install Node.js
+ if: github.event_name == 'workflow_dispatch'
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+
+ - name: Install pnpm
+ if: github.event_name == 'workflow_dispatch'
+ uses: pnpm/action-setup@v2
+ with:
+ version: 9
+
+ - name: Install Frontend Dependencies
+ if: github.event_name == 'workflow_dispatch'
+ working-directory: ./ui
+ run: pnpm install
+
+ - name: Install Tauri CLI
+ if: github.event_name == 'workflow_dispatch'
+ run: cargo install tauri-cli
+
- name: Rust Cache
uses: swatinem/rust-cache@v2
with:
@@ -71,6 +95,48 @@ jobs:
working-directory: ./src-tauri
run: cargo test --verbose
- - name: Build (Dev)
+ - name: Build Rust Only (Push/PR)
+ if: github.event_name != 'workflow_dispatch'
working-directory: ./src-tauri
run: cargo build --verbose
+
+ - name: Build App (Debug)
+ if: github.event_name == 'workflow_dispatch'
+ run: cargo tauri build --debug
+
+ - name: Get Short SHA
+ if: github.event_name == 'workflow_dispatch'
+ id: slug
+ run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
+
+ - name: Upload Artifact (Linux)
+ if: runner.os == 'Linux' && github.event_name == 'workflow_dispatch'
+ uses: actions/upload-artifact@v4
+ with:
+ name: dropout-linux-${{ matrix.wayland && 'arch' || 'ubuntu' }}-${{ steps.slug.outputs.sha8 }}
+ path: |
+ src-tauri/target/debug/bundle/appimage/*.AppImage
+ src-tauri/target/debug/bundle/deb/*.deb
+ src-tauri/target/debug/dropout
+ retention-days: 5
+
+ - name: Upload Artifact (Windows)
+ if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch'
+ uses: actions/upload-artifact@v4
+ with:
+ name: dropout-windows-${{ steps.slug.outputs.sha8 }}
+ path: |
+ src-tauri/target/debug/bundle/msi/*.msi
+ src-tauri/target/debug/bundle/nsis/*.exe
+ src-tauri/target/debug/dropout.exe
+ retention-days: 5
+
+ - name: Upload Artifact (macOS)
+ if: runner.os == 'macOS' && github.event_name == 'workflow_dispatch'
+ uses: actions/upload-artifact@v4
+ with:
+ name: dropout-macos-${{ steps.slug.outputs.sha8 }}
+ path: |
+ src-tauri/target/debug/bundle/dmg/*.dmg
+ src-tauri/target/debug/bundle/macos/DropOut.app
+ retention-days: 5