Last active
January 31, 2024 15:51
-
-
Save craeckor/e30062a52854fbd5b3ea81471d5500a8 to your computer and use it in GitHub Desktop.
Get latest release tag from a github repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
set header=-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" -H "Connection: keep-alive" -H "Pragma: no-cache" -H "Cache-Control: no-cache" | |
set repo=PowerShell/PowerShell | |
for /f "tokens=7 delims=/" %%i in ('curl -s !header! -I "https://github.com/!repo!/releases/latest" 2^>^&1 ^| findstr "Location:"') do ( | |
set tag=%%i | |
) | |
echo !tag! | |
endlocal | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment