Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/workflows/ci-on-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ repository:

Besides, a file never affects any job when it is a root file of documentation or
configuration: `*.md` (`AGENTS.md`, `CHANGELOG.md`, `README.md`…), `.gitignore`, `LICENSE`,
`CITATION.cff`, `_typos.toml`, `.markdownlint.json`, `.JuliaFormatter.toml`, `formatter.lock`.
`CITATION.cff`, `_typos.toml`, `.markdownlint.json`, `.JuliaFormatter.toml`, `formatter.lock`, and the issue and
pull request templates (`.github/ISSUE_TEMPLATE/`, `.github/pull_request_template.md`): no workflow reads them.
A file in one of the known directories of another scope (`docs/` for the tests, `test/` for
the documentation) does not affect this one. **Anything else counts**: `.github/` (a
workflow change can change what runs), a new top-level directory, a file the script does not
Expand Down
8 changes: 4 additions & 4 deletions scripts/ci-main/changes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const SCOPES = Dict(
"The top-level directories that belong to a scope above: a change in one of them leaves the other scopes alone."
const KNOWN_DIRS = ["src/", "ext/", "test/", "docs/"]

"Root files that change nothing a job runs: documentation and configuration of the repository."
const IGNORED = r"^(?:[^/]+\.md|\.gitignore|LICENSE|CITATION\.cff|_typos\.toml|\.markdownlint\.json|\.JuliaFormatter\.toml|formatter\.lock)$"
"Files that change nothing a job runs: the root documentation and configuration of the repository, and the issue and pull request templates."
const IGNORED = r"^(?:[^/]+\.md|\.gitignore|LICENSE|CITATION\.cff|_typos\.toml|\.markdownlint\.json|\.JuliaFormatter\.toml|formatter\.lock|\.github/ISSUE_TEMPLATE/.+|\.github/pull_request_template\.md)$"

allowed_actors() = filter(!isempty, strip.(split(get(ENV, "CT_CI_CHANGES_ONLY_ACTORS", join(DEFAULT_ACTORS, ",")), ",")))

Expand All @@ -63,8 +63,8 @@ allowed_actors() = filter(!isempty, strip.(split(get(ENV, "CT_CI_CHANGES_ONLY_AC

Whether a change to `file` (a path from the root) can affect the jobs of `scope`. A file in
one of the scope's directories does; a root file of documentation or configuration, or a
directory that belongs to another scope, does not; anything else (`.github/`, a new
top-level directory) does, because we cannot tell.
directory that belongs to another scope, or an issue or pull request template, does not;
anything else (the rest of `.github/`, a new top-level directory) does, because we cannot tell.
"""
function relevant(scope::AbstractString, file::AbstractString)
for p in SCOPES[scope]
Expand Down
6 changes: 6 additions & 0 deletions scripts/ci-main/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ end
@test !relevant(s, "CHANGELOG.md")
@test !relevant(s, "AGENTS.md")
@test !relevant(s, ".gitignore")
@test !relevant(s, ".github/ISSUE_TEMPLATE/bug.yml")
@test !relevant(s, ".github/ISSUE_TEMPLATE/config.yml")
@test !relevant(s, ".github/pull_request_template.md")
@test relevant(s, ".github/workflows/CI.yml") # unknown: run
@test relevant(s, ".github/dependabot.yml")
@test relevant(s, ".github/ISSUE_TEMPLATE") # the folder itself, not a template
@test relevant(s, "sub/.github/ISSUE_TEMPLATE/bug.yml")
@test relevant(s, "newdir/file.jl")
end
end
Expand Down
Loading