Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
test-tauri:
if: github.event.action == 'opened' || github.event.label.name == '需要 Action 构建'
if: github.event.action == 'opened' || (github.event.action == 'labeled' && github.event.label.name == '需要 Action 构建')

permissions:
contents: read
Expand Down Expand Up @@ -86,30 +86,30 @@ jobs:

outputs:
result: ${{ job.status }}
platform: ${{ matrix.name }}

cleanup:
needs: test-tauri
if: always() && (github.event.action == 'opened' || github.event.label.name == '需要 Action 构建')
if: always() && (github.event.action == 'opened' || (github.event.action == 'labeled' && github.event.label.name == '需要 Action 构建'))
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/github-script@v7
with:
script: |
const results = JSON.parse('${{ toJson(needs.test-tauri.result) }}');
const results = '${{ needs.test-tauri.result }}';
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const commit = context.sha.substring(0, 7);
const branch = context.ref.replace('refs/heads/', '');
const isLabelTrigger = '${{ github.event.action }}' === 'labeled';

let body = '';

if (results == 'success') {
if (results === 'success') {
body = `✅ **构建成功**\n\n`;
body += `- 分支: ${branch}\n`;
body += `- 提交: ${commit}\n`;
body += `- 触发方式: ${context.payload.action == 'opened' ? 'PR 创建' : '标签触发'}\n\n`;
body += `- 触发方式: ${isLabelTrigger ? '标签触发' : 'PR 创建'}\n\n`;
body += `**构建产物:**\n`;
body += `- macOS ARM64: \`tauri-app-macos-arm64\`\n`;
body += `- macOS x64: \`tauri-app-macos-x64\`\n`;
Expand All @@ -120,7 +120,7 @@ jobs:
body = `❌ **构建失败**\n\n`;
body += `- 分支: ${branch}\n`;
body += `- 提交: ${commit}\n`;
body += `- 触发方式: ${context.payload.action == 'opened' ? 'PR 创建' : '标签触发'}\n`;
body += `- 触发方式: ${isLabelTrigger ? '标签触发' : 'PR 创建'}\n`;
body += `- 失败状态: ${results}\n\n`;
body += `请检查以下可能原因:\n`;
body += `- 代码编译错误\n`;
Expand All @@ -136,7 +136,7 @@ jobs:
body: body
});

if (github.event.label.name == '需要 Action 构建') {
if (isLabelTrigger) {
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
Expand Down