FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql-action/src/codeql-bundle.ts at default-setup-testing · github/codeql-action · GitHub
github
codeql-action
Repository navigation
Code
Issues
165
(165)
Pull requests
44
(44)
Actions
Security and quality
2
(2)
Insights
Expand file tree
Breadcrumbs
codeql-action
/
src
/
codeql-bundle.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (65 loc) · 2.48 KB
Breadcrumbs
codeql-action
/
src
/
codeql-bundle.ts
Copy path
File metadata and controls
71 lines (65 loc) · 2.48 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import
{
BuiltInLanguage
,
parseBuiltInLanguage
}
from
"./languages"
;
import
{
BundlePlatform
}
from
"./platform"
;
import
type
{
CompressionMethod
}
from
"./tar"
;
/** Describes the contents and location of a downloadable CodeQL bundle. */
export
type
CodeQLBundle
=
|
{
kind
:
"combined"
;
url
:
string
}
|
{
kind
:
"per-language"
;
url
:
string
;
language
:
BuiltInLanguage
;
/** Only set when the Action selected the bundle, allowing a same-version fallback. */
combinedBundleURL
?:
string
;
}
;
/** A resolved download, including its bundle identity and version. */
export
interface
CodeQLDownloadSource
{
/** Distinguishes downloads from local archives and cached installations. */
sourceType
:
"download"
;
/** The bundle to download. */
bundle
:
CodeQLBundle
;
/** The compression format of the bundle archive. */
compressionMethod
:
CompressionMethod
;
/** Bundle version of the tools, if known. */
bundleVersion
?:
string
;
/** Requested CLI version, if known. */
cliVersion
?:
string
;
/** Resolved version for telemetry, independent of whether the bundle can be cached. */
toolsVersion
:
string
;
}
/** Returns the exact bundle asset name for a platform and optional language. */
export
function
getCodeQLBundleName
(
compressionMethod
:
CompressionMethod
,
platform
:
BundlePlatform
|
undefined
,
language
?:
BuiltInLanguage
,
)
:
string
{
const
extensions
:
Record
<
CompressionMethod
,
string
>
=
{
gzip
:
".tar.gz"
,
zstd
:
".tar.zst"
,
}
;
const
extension
=
extensions
[
compressionMethod
]
;
if
(
platform
===
undefined
)
{
return
`codeql-bundle
${
extension
}
`
;
}
if
(
language
!==
undefined
)
{
return
`codeql-bundle-
${
language
}
-
${
platform
}
${
extension
}
`
;
}
return
`codeql-bundle-
${
platform
}
${
extension
}
`
;
}
const
PER_LANGUAGE_BUNDLE_NAME
=
/
^
c
o
d
e
q
l
-
b
u
n
d
l
e
-
(
.
+
)
-
(?:
l
i
n
u
x
6
4
|
o
s
x
6
4
|
w
i
n
6
4
)
\.
t
a
r
\.
(?:
g
z
|
z
s
t
)
$
/
;
/** Classifies an explicit tools URL without changing it or adding a fallback. */
export
function
getCodeQLBundleFromUrl
(
url
:
string
)
:
CodeQLBundle
{
let
assetName
:
string
;
try
{
const
pathname
=
new
URL
(
url
)
.
pathname
;
// URL-encoded names must not bypass the toolcache safeguard.
assetName
=
decodeURIComponent
(
pathname
.
split
(
"/"
)
.
pop
(
)
??
""
)
;
}
catch
{
return
{
kind
:
"combined"
,
url
}
;
}
const
match
=
assetName
.
match
(
PER_LANGUAGE_BUNDLE_NAME
)
;
const
language
=
match
?
parseBuiltInLanguage
(
match
[
1
]
)
:
undefined
;
return
language
===
undefined
?
{
kind
:
"combined"
,
url
}
:
{
kind
:
"per-language"
,
url
,
language
}
;
}
Back
|
FazBrowse Home
|
New Git URL