From 6de91a63fddd98a647b903561a830991206558c2 Mon Sep 17 00:00:00 2001 From: rockleona <34214497+rockleona@users.noreply.github.com> Date: Tue, 9 Jun 2026 00:03:34 +0800 Subject: [PATCH 1/5] ci: support push-triggered runs in check_skip_ci --- .github/workflows/check_skip_ci.yml | 85 +++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check_skip_ci.yml b/.github/workflows/check_skip_ci.yml index 518f7219..3001c675 100644 --- a/.github/workflows/check_skip_ci.yml +++ b/.github/workflows/check_skip_ci.yml @@ -54,7 +54,6 @@ jobs: - name: scan label, description, and comments id: check - if: github.event_name == 'pull_request' uses: actions/github-script@v7 with: script: | @@ -66,38 +65,76 @@ jobs: const hasControlLine = text => (text || '').split(/\r?\n/) .some(line => control.test(line.trim())); - const pr = context.payload.pull_request; - // 1. The skip-ci label, set by a repository member. - if (pr.labels.some(label => label.name === 'skip-ci')) { - core.notice('CI skipped: the "skip-ci" label is present.'); - core.setOutput('skip', 'true'); - return; + async function checkPrNumber(prNumber) { + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + + if (pr.labels && pr.labels.some(label => label.name === 'skip-ci')) { + core.notice(`CI skipped: the "skip-ci" label is present on PR #${pr.number}.`); + return true; + } + + if (trusted.includes(pr.author_association) && hasControlLine(pr.body)) { + core.notice(`CI skipped: control string in the description of PR #${pr.number}.`); + return true; + } + + const comments = await github.paginate( + github.rest.issues.listComments, + { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + per_page: 100, + }); + const hit = comments.find( + comment => trusted.includes(comment.author_association) && hasControlLine(comment.body)); + if (hit) { + core.notice(`CI skipped: control string in a comment on PR #${pr.number}.`); + return true; + } + + return false; } - // 2. The control string in the pull request description. - if (trusted.includes(pr.author_association) && - hasControlLine(pr.body)) { - core.notice('CI skipped: control string in the description.'); - core.setOutput('skip', 'true'); + if (github.event_name === 'pull_request') { + const pr = context.payload.pull_request; + if (!pr) { + core.setOutput('skip', 'false'); + return; + } + const shouldSkip = await checkPrNumber(pr.number); + core.setOutput('skip', shouldSkip ? 'true' : 'false'); return; } - // 3. The control string in a comment from a member. - const comments = await github.paginate( - github.rest.issues.listComments, - { + else if (github.event_name === 'push') { + const sha = context.sha || context.payload.after; + if (!sha) { + core.setOutput('skip', 'false'); + return; + } + + const assoc = await github.rest.repos.listPullRequestsAssociatedWithCommit({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: pr.number, - per_page: 100, + commit_sha: sha, }); - const hit = comments.find( - comment => trusted.includes(comment.author_association) && - hasControlLine(comment.body)); - if (hit) { - core.notice('CI skipped: control string in a comment.'); - core.setOutput('skip', 'true'); + + const prs = assoc.data || []; + for (const p of prs) { + const num = p.number; + if (await checkPrNumber(num)) { + core.setOutput('skip', 'true'); + return; + } + } + + core.setOutput('skip', 'false'); return; } From 270b7c1cd94a5b8fe60081384e8d51ce4772ecc9 Mon Sep 17 00:00:00 2001 From: rockleona <34214497+rockleona@users.noreply.github.com> Date: Tue, 9 Jun 2026 00:03:58 +0800 Subject: [PATCH 2/5] ci: remove push and pull_request fire in profiling --- .github/workflows/profiling.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/profiling.yml b/.github/workflows/profiling.yml index 4d38364c..7aa9c70d 100644 --- a/.github/workflows/profiling.yml +++ b/.github/workflows/profiling.yml @@ -1,8 +1,6 @@ name: profiling on: - push: - pull_request: schedule: - cron: '34 17 * * *' From 6664c81011835a38e126b88fa13ba636a93e6c83 Mon Sep 17 00:00:00 2001 From: rockleona <34214497+rockleona@users.noreply.github.com> Date: Tue, 9 Jun 2026 19:51:57 +0800 Subject: [PATCH 3/5] ci: simplify condition for profiling job execution --- .github/workflows/profiling.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/profiling.yml b/.github/workflows/profiling.yml index 7aa9c70d..d6822dc6 100644 --- a/.github/workflows/profiling.yml +++ b/.github/workflows/profiling.yml @@ -9,7 +9,7 @@ jobs: # Run profiling only on schedule or when MMGH_FORCE_PROFILE is set to 'enable' # You can refer to https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables to set MMGH_FORCE_PROFILE in the fork repository settings for testing purposes. - if: ${{ (github.event_name == 'schedule' && vars.MMGH_NIGHTLY == 'enable') || vars.MMGH_FORCE_PROFILE == 'enable' }} + if: ${{ vars.MMGH_NIGHTLY == 'enable' || vars.MMGH_FORCE_PROFILE == 'enable' }} name: profile_${{ matrix.os }} From 4aa1ee7fd200adb8d77632d3204018f27550174a Mon Sep 17 00:00:00 2001 From: rockleona <34214497+rockleona@users.noreply.github.com> Date: Mon, 15 Jun 2026 19:47:26 +0800 Subject: [PATCH 4/5] Allow MMGH_FORCE_PROFILE to force profiling on push and pull_request Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/profiling.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/profiling.yml b/.github/workflows/profiling.yml index d6822dc6..88540103 100644 --- a/.github/workflows/profiling.yml +++ b/.github/workflows/profiling.yml @@ -3,12 +3,16 @@ name: profiling on: schedule: - cron: '34 17 * * *' + workflow_dispatch: + push: + pull_request: jobs: profile: - # Run profiling only on schedule or when MMGH_FORCE_PROFILE is set to 'enable' - # You can refer to https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables to set MMGH_FORCE_PROFILE in the fork repository settings for testing purposes. + # Run profiling on schedule or when MMGH_FORCE_PROFILE is set to 'enable'. + # MMGH_FORCE_PROFILE can force profiling for push and pull_request events. + # See: https://docs.github.com/en/actions/learn-github-actions/variables#organization-and-repository-variables if: ${{ vars.MMGH_NIGHTLY == 'enable' || vars.MMGH_FORCE_PROFILE == 'enable' }} name: profile_${{ matrix.os }} From d63f21fa48966b2df6e1026ea65bdbecb1a31f2b Mon Sep 17 00:00:00 2001 From: rockleona <34214497+rockleona@users.noreply.github.com> Date: Mon, 15 Jun 2026 19:49:01 +0800 Subject: [PATCH 5/5] Simplify check_skip_ci: use skip-ci label as single source-of-truth (remove control-line detection) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/check_skip_ci.yml | 37 +++-------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/.github/workflows/check_skip_ci.yml b/.github/workflows/check_skip_ci.yml index 3001c675..0ca3822e 100644 --- a/.github/workflows/check_skip_ci.yml +++ b/.github/workflows/check_skip_ci.yml @@ -57,16 +57,7 @@ jobs: uses: actions/github-script@v7 with: script: | - const trusted = ['OWNER', 'MEMBER', 'COLLABORATOR']; - // The control string is honored only when it is alone on a line - // by itself, so that prose mentioning it does not accidentally - // skip CI. - const control = /^\[skip-ci\]$/i; - const hasControlLine = text => - (text || '').split(/\r?\n/) - .some(line => control.test(line.trim())); - - async function checkPrNumber(prNumber) { + async function hasSkipLabelOnPr(prNumber) { const { data: pr } = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, @@ -77,27 +68,6 @@ jobs: core.notice(`CI skipped: the "skip-ci" label is present on PR #${pr.number}.`); return true; } - - if (trusted.includes(pr.author_association) && hasControlLine(pr.body)) { - core.notice(`CI skipped: control string in the description of PR #${pr.number}.`); - return true; - } - - const comments = await github.paginate( - github.rest.issues.listComments, - { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - per_page: 100, - }); - const hit = comments.find( - comment => trusted.includes(comment.author_association) && hasControlLine(comment.body)); - if (hit) { - core.notice(`CI skipped: control string in a comment on PR #${pr.number}.`); - return true; - } - return false; } @@ -107,7 +77,7 @@ jobs: core.setOutput('skip', 'false'); return; } - const shouldSkip = await checkPrNumber(pr.number); + const shouldSkip = await hasSkipLabelOnPr(pr.number); core.setOutput('skip', shouldSkip ? 'true' : 'false'); return; } @@ -127,8 +97,7 @@ jobs: const prs = assoc.data || []; for (const p of prs) { - const num = p.number; - if (await checkPrNumber(num)) { + if (await hasSkipLabelOnPr(p.number)) { core.setOutput('skip', 'true'); return; }