diff --git a/.github/workflows/pr-check-comment.yml b/.github/workflows/pr-check-comment.yml index 249e649..cba9e12 100644 --- a/.github/workflows/pr-check-comment.yml +++ b/.github/workflows/pr-check-comment.yml @@ -21,21 +21,18 @@ jobs: with: script: | const fs = require('fs'); - const path = require('path'); - // 获取所有 artifacts const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: context.payload.workflow_run.id, }); - console.log(`Found ${artifacts.data.artifacts.length} artifacts`); + console.log('Found artifacts:', artifacts.data.artifacts.length); - // 下载所有平台的状态文件 for (const artifact of artifacts.data.artifacts) { if (artifact.name.startsWith('pr-check-state-')) { - console.log(`Downloading artifact: ${artifact.name}`); + console.log('Downloading:', artifact.name); const download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, @@ -44,7 +41,7 @@ jobs: archive_format: 'zip', }); - fs.writeFileSync(`${artifact.name}.zip`, Buffer.from(download.data)); + fs.writeFileSync(artifact.name + '.zip', Buffer.from(download.data)); } } @@ -66,49 +63,41 @@ jobs: const path = require('path'); const marker = ''; - const stateMarker = '` + '' ].join('\n'); - // 查找现有评论 const { data: comments } = await github.rest.issues.listComments({ issue_number: prNumber, owner: context.repo.owner, @@ -202,10 +187,10 @@ jobs: per_page: 100 }); - const existing = comments.find((c) => c.body.includes(marker)); + const existing = comments.find(c => c.body.includes(marker)); if (existing) { - console.log(`Updating existing comment #${existing.id}`); + console.log('Updating existing comment', existing.id); await github.rest.issues.updateComment({ comment_id: existing.id, owner: context.repo.owner,