FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lnav/donwl.ps1 at master · tstack/lnav · GitHub
tstack
/
lnav
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
404
Star
10.7k
Code
Issues
283
Pull requests
10
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
lnav
/
donwl.ps1
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (40 loc) · 2.1 KB
Breadcrumbs
lnav
/
donwl.ps1
Copy path
File metadata and controls
50 lines (40 loc) · 2.1 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
#
Define variables
$RepoOwner
=
"
tstack
"
#
Change this if you're using your fork
$RepoName
=
"
lnav
"
$ArtifactName
=
"
lnav-master-windows-amd64.zip
"
#
Update if needed
$InstallPath
=
"
C:\Program Files\lnav
"
#
Get the latest run with artifacts
$LatestRunUrl
=
"
https://api.github.com/repos/
$RepoOwner
/
$RepoName
/actions/runs
"
$LatestRun
=
Invoke-RestMethod
-
Uri
$LatestRunUrl
-
Headers
@
{
"
Accept
"
=
"
application/vnd.github.v3+json
"
}
$RunId
=
$LatestRun
.workflow_runs
[
0
].id
#
Get latest run ID
#
Get artifacts from the latest run
$ArtifactsUrl
=
"
https://api.github.com/repos/
$RepoOwner
/
$RepoName
/actions/runs/
$RunId
/artifacts
"
$Artifacts
=
Invoke-RestMethod
-
Uri
$ArtifactsUrl
-
Headers
@
{
"
Accept
"
=
"
application/vnd.github.v3+json
"
}
#
Find the Windows artifact
$Artifact
=
$Artifacts
.artifacts
|
Where-Object
{
$_
.name
-eq
$ArtifactName
}
if
(
-not
$Artifact
) {
Write-Host
"
❌ Windows artifact not found. Exiting...
"
exit
1
}
#
Download the artifact
$DownloadUrl
=
$Artifact
.archive_download_url
$ZipPath
=
"
$
env:
TEMP
\lnav-windows.zip
"
#
GitHub API requires authentication to download workflow artifacts
$GitHubToken
=
Read-Host
"
Enter GitHub Token (with repo read permissions)
"
-
AsSecureString
$BSTR
=
[
System.Runtime.InteropServices.Marshal
]::SecureStringToBSTR(
$GitHubToken
)
$PlainToken
=
[
System.Runtime.InteropServices.Marshal
]::PtrToStringAuto(
$BSTR
)
Invoke-WebRequest
-
Uri
$DownloadUrl
-
Headers
@
{
"
Authorization
"
=
"
token
$PlainToken
"
}
-
OutFile
$ZipPath
#
Extract and install
$ExtractPath
=
"
$
env:
TEMP
\lnav
"
Expand-Archive
-
Path
$ZipPath
-
DestinationPath
$ExtractPath
-
Force
#
Move to install location
if
(
Test-Path
$InstallPath
) {
Remove-Item
-
Recurse
-
Force
$InstallPath
}
Move-Item
-
Path
"
$ExtractPath
\*
"
-
Destination
$InstallPath
-
Force
#
Add to PATH
$SystemPath
=
[
System.Environment
]::GetEnvironmentVariable(
"
Path
"
,
[
System.EnvironmentVariableTarget
]::Machine)
if
(
$SystemPath
-notlike
"
*
$InstallPath
*
"
) {
[
System.Environment
]::SetEnvironmentVariable(
"
Path
"
,
"
$SystemPath
;
$InstallPath
"
,
[
System.EnvironmentVariableTarget
]::Machine)
}
Write-Host
"
✅ lnav installed successfully! Run 'lnav' in a new terminal.
"
Back
|
FazBrowse Home
|
New Git URL