Skip to content

ci: 🎡 judge a pull request by its own changes - #52

Closed
ChenYilong wants to merge 3 commits into
masterfrom
ci/docs-only-pr-diff
Closed

ChenYilong wants to merge 3 commits into
masterfrom
ci/docs-only-pr-diff

Conversation

@ChenYilong

Copy link
Copy Markdown
Owner

Summary

Fixes why documents-only pull requests still ran the full CI.

Evidence: PR #50 changes documents only, yet its Changes job decided Run the CI jobs: true (code changed since aae5ea24…, the nearest commit with a successful ios.yml run). Its base, master 5da2db61, had no finished iOS run yet, so the script fell back to an older green master commit. PR #48's code, merged into master in between, then counted as PR #50's.

Logic hole: the nearest-green rule is right for pushes, so a branch head never looks green over untested code. It was also applied to pull requests, though, and because macOS runs take hours, the base's newest commit is almost never green when a documents PR is opened.

Fix (scripts/ci-changes.sh): on a pull_request event, if the PR changes only documents since its merge base, its jobs are skipped, whatever state the base is in. The base's own push runs still report the base. Pushes keep the nearest-green rule.

Tested locally on real commits:

Case Decision
PR #50 (documents only, base not green yet) skip
PR #49, PR #51 (code) run
Push of the same documents commit skip
Manual run run
PR that moves a script into docs/ run

The rule text is updated in docs/instructions/ci-cd.md, AGENTS.md, CLAUDE.md and docs/prompts/ci-documents-only.md.


Generated by Claude Code

PR #50 changed only documents but ran the full CI: its base had no
finished run yet, so the nearest-green rule fell back to an older
master commit and counted the base's newer code as the pull request's.
On a pull_request event, ci-changes.sh now skips when the pull request
changes only documents since its merge base, whatever the base's
state; pushes keep the nearest-green rule.

By @ChenYilong <luohanchenyilong@163.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017y7XP2P2UnTvzHG1KZL67A
From an advisor review of the documents-only rule: the green list
counted pull request runs, including skipped documents runs on
untested code, so it now counts only push and manual runs; pushes to
claude/** ran the push rule next to the pull request run on the same
commit, so the workflows now run on pushes to master only; Markdown
shipped in the package's resources counts as code. The rule text in
ci-cd.md, ios.yml and the script header says which rule applies to
pushes and which to pull requests.

By @ChenYilong <luohanchenyilong@163.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017y7XP2P2UnTvzHG1KZL67A
From CYLSearchViewController's report. ci-changes.sh searched only the
first-parent history, stopped at the first green commit, and treated
identical files as code. It now searches all parents, takes the first
green commit whose files equal the head's or differ only in documents,
and counts an empty diff as a match. sync-spm-mirror.sh gives its fresh
clone the Actions bot identity when none is set, so a release on a
runner no longer stops with "Author identity unknown". New tests:
scripts/test-ci-changes.sh (12 cases; 8 passed before, 12 after), run
by the shellcheck job.

By @ChenYilong <luohanchenyilong@163.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017y7XP2P2UnTvzHG1KZL67A
ChenYilong pushed a commit that referenced this pull request Dec 4, 2026
By @ChenYilong <luohanchenyilong@163.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017y7XP2P2UnTvzHG1KZL67A

Copy link
Copy Markdown
Owner Author

Merged into #53 (build/examples-spm, commit af7ef8d) at the owner's request to keep one open pull request for the SwiftPM migration. Closing this one; the work continues in #53.


Generated by Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants