mirror of
https://github.com/julia-actions/julia-runtest.git
synced 2026-03-02 20:06:54 +08:00
Add the force_latest_compatible_version input, and add the "auto-detect Dependabot/CompatHelper" functionality (#20)
Co-authored-by: Sascha Mann <git@mail.saschamann.eu>
This commit is contained in:
25
autodetect-dependabot.jl
Normal file
25
autodetect-dependabot.jl
Normal file
@@ -0,0 +1,25 @@
|
||||
module AutodetectDependabot
|
||||
|
||||
function _get_possible_branch_names()
|
||||
possible_branch_names = [
|
||||
get(ENV, "GITHUB_BASE_REF", ""),
|
||||
get(ENV, "GITHUB_HEAD_REF", ""),
|
||||
get(ENV, "GITHUB_REF", ""),
|
||||
]
|
||||
return possible_branch_names
|
||||
end
|
||||
|
||||
function _chop_refs_head(branch_name::AbstractString)
|
||||
replace(branch_name, r"^(refs\/heads\/)" => "")
|
||||
end
|
||||
|
||||
function _is_dependabot_branch(branch_name::AbstractString)
|
||||
return startswith(branch_name, "dependabot/julia") || startswith(branch_name, "compathelper/")
|
||||
end
|
||||
|
||||
function is_dependabot_job()
|
||||
possible_branch_names = _get_possible_branch_names()
|
||||
return any(_is_dependabot_branch.(_chop_refs_head.(possible_branch_names)))
|
||||
end
|
||||
|
||||
end # module
|
||||
Reference in New Issue
Block a user