[release/13.2] Move CI trigger patterns out of ci.yml into a separate file#14748
[release/13.2] Move CI trigger patterns out of ci.yml into a separate file#14748radical merged 4 commits intorelease/13.2from
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14748Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14748" |
|
@copilot Remove comments about "legacy" or "deprecated" bits. Fix the md linter errors. Review the changes to the scripts. |
Done in 640367c:
|
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22599256854 |
d2fe8d8 to
cd13cea
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors CI trigger skip patterns by moving them from inline YAML in .github/workflows/ci.yml to a dedicated glob patterns file at eng/testing/github-ci-trigger-patterns.txt. This decoupling means that updating skip patterns no longer triggers CI, while changes to the actual CI workflow logic still do.
Changes:
- New glob patterns file (
eng/testing/github-ci-trigger-patterns.txt) containing file patterns that skip CI when changed - Updated
check-changed-filesaction to read glob patterns from a file and convert them to regex at runtime - Modified
ci.ymlworkflow to use the new patterns file instead of inline regex patterns - Added documentation explaining the patterns file format and usage
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
eng/testing/github-ci-trigger-patterns.txt |
New glob patterns file listing files/patterns that don't require CI (docs, pipeline configs, unrelated workflows) |
.github/actions/check-changed-files/action.yml |
Added patterns_file input, glob_to_regex() function to convert glob patterns to anchored ERE regex, and file reading logic |
.github/workflows/ci.yml |
Replaced inline patterns: block with reference to patterns_file: eng/testing/github-ci-trigger-patterns.txt |
docs/ci/ci-trigger-patterns.md |
New documentation explaining glob syntax, pattern semantics, how to add patterns, and implementation details |
Comments suppressed due to low confidence (5)
docs/ci/ci-trigger-patterns.md:63
- The documentation states that
.and other regex metacharacters (+,?,[,],(,),|) are escaped, but doesn't mention that backslash\is also escaped (line 82 in the action). While backslashes are rare in Unix paths, the documentation should be complete. Additionally, the documentation doesn't mention that{and}are NOT escaped, which could cause issues if file paths contain literal braces.
- `.` and other regex metacharacters (`+`, `?`, `[`, `]`, `(`, `)`, `|`) → escaped with `\`
.github/actions/check-changed-files/action.yml:81
- The comment states that
$is not escaped because it "cannot appear in file paths," but$can actually appear in Unix file names (e.g.,file$name.txt). If someone creates a glob pattern for such a file, the unescaped$would be interpreted as an end-of-line anchor in the regex, causing the pattern to fail. Consider escaping$along with the other special characters to handle this edge case.
# Note: { } ^ $ are not escaped because they are either not special
# in ERE mid-pattern or cannot appear in file paths.
.github/actions/check-changed-files/action.yml:81
- The comment states that
^is not escaped because it's "not special in ERE mid-pattern or cannot appear in file paths," but^can appear in Unix file names (e.g.,^file.txt). If someone creates a glob pattern^file.txt, the unescaped^combined with the anchoring at line 95 would create an invalid regex like^^file\.txt$. Consider escaping^to handle this edge case.
# Note: { } ^ $ are not escaped because they are either not special
# in ERE mid-pattern or cannot appear in file paths.
eng/testing/github-ci-trigger-patterns.txt:1
- The file name in the PR description references
eng/testing/ci-trigger-patterns.txt, but the actual file created iseng/testing/github-ci-trigger-patterns.txt(note thegithub-prefix). This inconsistency should be corrected - either rename the file to match the description, or update all references in the description and documentation to includegithub-.
# CI trigger patterns
.github/actions/check-changed-files/action.yml:81
- The comment claims that
^and$are not escaped because they "are either not special in ERE mid-pattern or cannot appear in file paths." However, this reasoning is incomplete. While it's true that^and$cannot appear in file paths,{and}(which also aren't escaped) CAN appear in file paths and ARE special in ERE (for repetition quantifiers like{1,3}). If a file path contains literal braces (e.g.,foo{bar}.txt), the glob pattern would fail to match it correctly. Consider adding{and}to the list of escaped characters, or update the comment to acknowledge this limitation.
# Note: { } ^ $ are not escaped because they are either not special
# in ERE mid-pattern or cannot appear in file paths.
Extract the CI-skip glob patterns into eng/testing/github-ci-trigger-patterns.txt so that pattern maintenance is decoupled from the workflow definition. Changing this file alone will not trigger CI, avoiding the chicken-and-egg problem of the patterns being inlined in ci.yml. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the inline regex patterns input with a patterns_file input that points to a file of glob patterns. Add a glob_to_regex() function that converts glob syntax (**, *, literal dot) to anchored ERE regexes. The action now: - reads patterns from a file, skipping comments and blank lines - converts each glob to an anchored regex before matching - escapes regex metacharacters (. + ? [ ] ( ) |) in glob literals Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the inline regex patterns block in ci.yml with a single patterns_file reference to eng/testing/github-ci-trigger-patterns.txt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Explain the patterns file, its glob syntax, how to add new patterns, and how the check-changed-files action converts globs to ERE regexes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cd13cea to
95f5efc
Compare
|
/ba-g unrelated |
… file (#14748) * feat: add CI trigger patterns file Extract the CI-skip glob patterns into eng/testing/github-ci-trigger-patterns.txt so that pattern maintenance is decoupled from the workflow definition. Changing this file alone will not trigger CI, avoiding the chicken-and-egg problem of the patterns being inlined in ci.yml. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: read glob patterns from file in check-changed-files action Replace the inline regex patterns input with a patterns_file input that points to a file of glob patterns. Add a glob_to_regex() function that converts glob syntax (**, *, literal dot) to anchored ERE regexes. The action now: - reads patterns from a file, skipping comments and blank lines - converts each glob to an anchored regex before matching - escapes regex metacharacters (. + ? [ ] ( ) |) in glob literals Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: use patterns_file in CI workflow Replace the inline regex patterns block in ci.yml with a single patterns_file reference to eng/testing/github-ci-trigger-patterns.txt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: add CI trigger patterns documentation Explain the patterns file, its glob syntax, how to add new patterns, and how the check-changed-files action converts globs to ERE regexes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Ankit Jain <radical@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Inline patterns in
ci.ymlmeant every pattern update (e.g. adding a new skip rule) triggered full CI on itself. Patterns are now in a dedicated file soci.ymlonly changes when the workflow logic changes.Description
eng/testing/ci-trigger-patterns.txt– new glob-style patterns file. Supports**(recursive),*(single segment), and literal.(no backslash escaping). Comments (#) and blank lines ignored. The file lists itself so updating patterns doesn't trigger CI..github/actions/check-changed-files/action.yml– addspatterns_fileinput; reads the file at runtime and converts each glob line to an anchored ERE regex viaglob_to_regex()(**→.*,*→[^/]*,.→\.). The existingpatterns(raw regex) input is retained alongsidepatterns_file..github/workflows/ci.yml– replaces the inlinepatterns:block with:docs/ci/ci-trigger-patterns.md– new doc explaining the file format, glob syntax, and how to add new entries.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue:🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.