Skip to content
Merged
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
14 changes: 11 additions & 3 deletions github_actions/lib/dependabot/github_actions/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ def workfile_file_dependencies(file)
end

def build_github_dependency(file, string)
unless source.hostname == "github.com"
dep = github_dependency(file, string, source.hostname)
git_checker = Dependabot::GitCommitChecker.new(dependency: dep, credentials: credentials)
return dep if git_checker.git_repo_reachable?
end

github_dependency(file, string, "github.com")
end

def github_dependency(file, string, hostname)
details = string.match(GITHUB_REPO_REFERENCE).named_captures
name = "#{details.fetch('owner')}/#{details.fetch('repo')}"
url = "https://#{source.hostname}/#{name}"

ref = details.fetch("ref")
version = version_class.new(ref).to_s if version_class.correct?(ref)
Dependency.new(
Expand All @@ -67,7 +75,7 @@ def build_github_dependency(file, string)
groups: [],
source: {
type: "git",
url: url,
url: "https://#{hostname}/#{name}",
ref: ref,
branch: nil
},
Expand Down