diff --git a/.github/workflows/pr-commit-check.yml b/.github/workflows/pr-commit-check.yml new file mode 100644 index 000000000..0d7c8843e --- /dev/null +++ b/.github/workflows/pr-commit-check.yml @@ -0,0 +1,99 @@ +name: PR Commit Check + +on: + pull_request_target: + types: + - opened + - edited + - ready_for_review + - reopened + - synchronize + +permissions: + contents: read + issues: write + pull-requests: read + +jobs: + check-commits: + name: Check Commits in PR + if: ${{ !github.event.pull_request.merged }} + runs-on: ubuntu-latest + steps: + - name: Clean up previous comment + uses: actions/github-script@v8 + with: + script: | + const marker = ''; + const comments = await github.paginate(github.rest.issues.listComments, { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + per_page: 100, + }); + + const previousComments = comments.filter(comment => + comment.user.login === 'github-actions[bot]' && comment.body.includes(marker) + ); + + for (const comment of previousComments) { + await github.rest.issues.deleteComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id, + }); + } + + - name: Check commits + uses: actions/github-script@v8 + with: + script: | + const marker = ''; + const commits = await github.paginate(github.rest.pulls.listCommits, { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + per_page: 100, + }); + + const regex = /^(?:(?:build|chore|ci|docs?|feat|fix|perf|refactor|rft|style|styles|test|i18n|typo|debug|ai)(?:\([^)]+\))?!?:\s|(?:[Rr]evert|[Rr]elease|[Rr]eapply)\b)/; + + const invalidCommits = commits.filter(commit => { + const title = commit.commit.message.split('\n')[0]; + return !regex.test(title) || commit.parents.length > 1; + }); + + console.log(`Checked ${commits.length} commit(s)`); + + if (invalidCommits.length === 0) { + console.log('All commits passed validation'); + return; + } + + const invalidCommitNames = invalidCommits.map(commit => commit.commit.message); + const invalidCommitInfoList = invalidCommits + .map(commit => { + const title = commit.commit.message.split('\n')[0]; + const reason = commit.parents.length > 1 ? 'merge commit' : 'invalid format'; + return `- ${title} [\`${commit.sha.substring(0, 7)}\`](${commit.html_url}) (${reason})`; + }) + .join('\n'); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: `${marker} +## ⚠️ Found ${invalidCommits.length} invalid commit(s) + +${invalidCommitInfoList} + +--- +Please follow the Conventional Commits format used in this repository, and **do not** use merge commits in pull requests. + +Accepted prefixes include: \`build\`, \`chore\`, \`ci\`, \`docs\`, \`feat\`, \`fix\`, \`perf\`, \`refactor\`, \`rft\`, \`style\`, \`test\`, \`i18n\`, \`typo\`, \`debug\`, \`ai\`. + +请遵循本仓库使用的 Conventional Commits 规范,并且**不要**在 Pull Request 中使用 Merge Commit。`, + }); + + core.setFailed(`Found ${invalidCommits.length} invalid commit(s):\n${invalidCommitNames.join('\n-------------------\n')}`); diff --git a/.github/workflows/task-issue-auto-label.yml b/.github/workflows/task-issue-auto-label.yml index 5b1454df8..2b59198bf 100644 --- a/.github/workflows/task-issue-auto-label.yml +++ b/.github/workflows/task-issue-auto-label.yml @@ -1,4 +1,4 @@ -name: task issue auto label +1name: task issue auto label on: issues: diff --git a/assets/resource/image/SceneManager/LoginAnnouncementClose.png b/assets/resource/image/SceneManager/LoginAnnouncementClose.png new file mode 100644 index 000000000..f0d81e8a9 Binary files /dev/null and b/assets/resource/image/SceneManager/LoginAnnouncementClose.png differ diff --git a/assets/resource/pipeline/SceneManager/SceneLogin.json b/assets/resource/pipeline/SceneManager/SceneLogin.json index 30bed26da..baa42dffd 100644 --- a/assets/resource/pipeline/SceneManager/SceneLogin.json +++ b/assets/resource/pipeline/SceneManager/SceneLogin.json @@ -15,10 +15,9 @@ ] } }, - "action": "ClickKey", - "key": 27, // 公告弹窗截不到图无法识别,因此硬编码ESC "next": [ "__ScenePrivateLoginContinue", + "[JumpBack]__ScenePrivateCloseLoginAnnouncement", "__ScenePrivateLogin" ] }, @@ -52,6 +51,50 @@ "[JumpBack]__ScenePrivateLoginCloseDialog" ] }, + "__ScenePrivateCloseLoginAnnouncement": { + "desc": "关闭登录时公告界面", + "recognition": "And", + "all_of": [ + { + "sub_name": "__ScenePrivateCloseAnnouncementButton", + "recognition": { + "type": "TemplateMatch", + "desc": "识别登录时公告界面的关闭按钮,这里不用通用按钮的原因是 roi 和模版大小都不同", + "param": { + "roi": [ + 1178, + 59, + 26, + 28 + ], + "template": [ + "SceneManager/LoginAnnouncementClose.png" + ] + } + } + }, + { + "recognition": { + "type": "OCR", + "desc": "识别是否在公告界面", + "param": { + "roi": [ + 252, + 18, + 817, + 179 + ], + "expected": [ + "公告" + ] + } + } + } + ], + "action": { + "type": "Click" + } + }, "__ScenePrivateLoginMonthlyPassConfirm": { "desc": "领取月卡,无法跳过必须领取", "recognition": {