Skip to content

Commit

Permalink
⭐️ expose github download url (#4447)
Browse files Browse the repository at this point in the history
* ⭐️ expose github download url

* Update providers/github/resources/github.lr

Co-authored-by: Tim Smith <tsmith84@gmail.com>

---------

Co-authored-by: Tim Smith <tsmith84@gmail.com>
  • Loading branch information
chris-rock and tas50 authored Jul 30, 2024
1 parent 5425042 commit a0b0d98
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions providers/github/resources/github.lr
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ private github.file @defaults("name type") {
repoName string
// File content
content() string
// File download URL
downloadUrl string
}

// GitHub release
Expand Down
12 changes: 12 additions & 0 deletions providers/github/resources/github.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions providers/github/resources/github.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ resources:
github.file:
fields:
content: {}
downloadUrl:
min_mondoo_version: 9.0.0
files: {}
isBinary: {}
name:
Expand Down
15 changes: 8 additions & 7 deletions providers/github/resources/github_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,13 +1115,14 @@ func newMqlGithubFile(runtime *plugin.Runtime, ownerName string, repoName string
}
}
res, err := CreateResource(runtime, "github.file", map[string]*llx.RawData{
"path": llx.StringDataPtr(content.Path),
"name": llx.StringDataPtr(content.Name),
"type": llx.StringDataPtr(content.Type),
"sha": llx.StringDataPtr(content.SHA),
"isBinary": llx.BoolData(isBinary),
"ownerName": llx.StringData(ownerName),
"repoName": llx.StringData(repoName),
"path": llx.StringDataPtr(content.Path),
"name": llx.StringDataPtr(content.Name),
"type": llx.StringDataPtr(content.Type),
"sha": llx.StringDataPtr(content.SHA),
"isBinary": llx.BoolData(isBinary),
"ownerName": llx.StringData(ownerName),
"repoName": llx.StringData(repoName),
"downloadUrl": llx.StringDataPtr(content.DownloadURL),
})
if err != nil {
return nil, err
Expand Down

0 comments on commit a0b0d98

Please sign in to comment.