Skip to content

Ensure skip-ci label workable and simplify profiling job conditions#877

Open
rockleona wants to merge 3 commits into
solvcon:masterfrom
rockleona:issue-858
Open

Ensure skip-ci label workable and simplify profiling job conditions#877
rockleona wants to merge 3 commits into
solvcon:masterfrom
rockleona:issue-858

Conversation

@rockleona

Copy link
Copy Markdown
Collaborator

Simplify profiling job conditions and ensure the skip-ci label is honored for push-triggered updates so CI runs are not noisy or duplicated.

This PR removes push/pull_request triggers from the profiling workflow and updates check_skip_ci to detect and respect skip-ci on push-triggered runs so profiling jobs run only when intended.

Related to #858.

Comment on lines +69 to +101
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;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper function will check the content in specific PR, and return boolean of true if it needs to skip.

Comment on lines +104 to 139
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;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_skip_ci will call by other action (workflow), it will check what triggered the action and check if the push commit is related to any PR, then call the helper function checkPrNumber.

Comment on lines -4 to -5
push:
pull_request:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these 2 triggers


# 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' }}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So no need to check event_name since the trigger is clean.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If removing push and pull_request from on, MMGH_FORCE_PROFILE will not work when on is not schedule. We need to allow to use MMGH_FORCE_PROFILE to force profiling on push and pull_request.

@yungyuc yungyuc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Need to allow to use MMGH_FORCE_PROFILE to force profiling on push and pull_request.
  • Reduce patch complexity if possible.


# 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' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If removing push and pull_request from on, MMGH_FORCE_PROFILE will not work when on is not schedule. We need to allow to use MMGH_FORCE_PROFILE to force profiling on push and pull_request.

core.notice('CI skipped: the "skip-ci" label is present.');
core.setOutput('skip', 'true');
return;
async function checkPrNumber(prNumber) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch looks overly complex. I am not sure why a simple conditional check need to use async. If it is necessary, explain in PR annotation. If it is not, use minimal diff for the fix.

@yungyuc yungyuc added the build Build system and automation label Jun 9, 2026
@yungyuc

yungyuc commented Jun 9, 2026

Copy link
Copy Markdown
Member

@ExplorerRay @chestercheng please help take a look.

@chestercheng

Copy link
Copy Markdown
Collaborator

The requirement in #858 seems to be:

  • If the PR has the skip-ci label, a later push should not run CI.
  • If the PR does not have the skip-ci label, a later push should run CI.

So, I wonder if we can simplify this design.

Maybe we can make the skip-ci label the single source of truth,
so that check_skip_ci.yml only manages the label and all other workflows
only check the label.

Then labels become the only CI gate:

  • skip-ci controls whether CI should be skipped.
  • profiling controls whether the profiling workflow should run.
  • Removing skip-ci allows CI to run again.

This may make the behavior easier to understand and maintain.

@yungyuc

yungyuc commented Jun 11, 2026

Copy link
Copy Markdown
Member

The requirement in #858 seems to be:

  • If the PR has the skip-ci label, a later push should not run CI.
  • If the PR does not have the skip-ci label, a later push should run CI.

Issue #858 is just about the skip-ci label, but the full picture includes the [skip-ci] control line in PR comments: #814 (comment) . See also PR #820 .

Maybe we can make the skip-ci label the single source of truth, so that check_skip_ci.yml only manages the label and all other workflows only check the label.

It sounds like a good simplification for check_skip_ci.yml to be a single source of truth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build system and automation

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants