https://github.com/samfisherirl/github.ahk-api-for-ahkv2
Github.ahk - Ahk1 & Ahk2 - a Modular Library to Download latest releases from the Github API and store version data.
https://github.com/samfisherirl/github.ahk-api-for-ahkv2
api autohotkey github release
Last synced: about 1 year ago
JSON representation
Github.ahk - Ahk1 & Ahk2 - a Modular Library to Download latest releases from the Github API and store version data.
- Host: GitHub
- URL: https://github.com/samfisherirl/github.ahk-api-for-ahkv2
- Owner: rylefisher
- Created: 2022-10-05T20:34:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-28T01:02:33.000Z (almost 2 years ago)
- Last Synced: 2025-04-23T12:57:18.063Z (about 1 year ago)
- Topics: api, autohotkey, github, release
- Language: AutoHotkey
- Homepage:
- Size: 280 KB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Github.ahk
A modular library to download latest releases from the github API, among other github timesavers.
credit to JXON v2 creator https://github.com/TheArkive/JXON_ahk2

## AHK v2 Method list
### Quick start - Download a release
```autohotkey
usr := "samfisherirl"
repo := "Github.ahk-API-for-AHKv2"
#Include %A_ScriptDir%\lib\github.ahk
;simple
latestObj := Github.latest(usr, repo)
Nsgbox latestObj.downloadURLs[1]
; array has all downloads under release tag, for source code view below
;latestObj.downloadURLs[1] = url to => "releasev1.1.zip"
;latestObj.downloadURLs[2] = url to => "releasev1.1.rar"
```
### Check version data
```autohotkey
currentVersion := "v1"
if currentVersion != latestObj.version
{
MsgBox "Time for an update, latest version is "
. latestObj.version " updated on " latestObj.date "`nNotes:`n"
. latestObj.change_notes "`n`nLink: " latestObj.DownloadURLs[1]
}
```
### Download release
```autohotkey
userResponse := MsgBox(
"Github.ahk-API-for-AHKv2's latest update is dated:`n"
latestObj.date "`nVersion: " latestObj.version
"`nWould you like to download?",, '36')
if (userResponse = "Yes"){
Github.Download(latestObj.downloadURLs[1], A_ScriptDir "\download")
;latestObj.downloadURLs[] = array of release files - IE
;latestObj.downloadURLs[1] = url to => "releasev1.1.zip"
;latestObj.downloadURLs[2] = url to => "releasev1.1.rar"
}
for url in latestObj.downloadURLs {
if InStr(url, ".zip") {
Github.download(url, A_ScriptDir)
break
}
}
```
### Download source data and historic releases
```autohotkey
Github.Source(usr, repo, A_ScriptDir "\main.zip")
; download main branch source code
; Multiple Assets use-case
; enumerate ==ALL Historic Releases==
repo_string := ""
for repo in Github.historicReleases(usr, repo) {
/*
downloadURLs: [],
version: "",
change_notes: "",
date: ""
*/
repo_string .= repo.name " version " repo.version " was released on " repo.date "`nUpdate notes: `n"
repo_string .= repo.change_notes "`nDownload Link: " repo.downloadURL "`n`n"
}
MsgBox(repo_string)
```
## AHK v1 Method list:
```autohotkey
using this url as an example: https://github.com/samfisherirl/github.ahk
object:
git := new Github("username/repository") ;instantiate the object
git.DL("geo") ; downloads the latest release, saving to "geo.zip" relative path, you can use any name.
git.release() ; Url of release
git.details() ; return changes made for latest update
git.tag() ; returns only version number, ie "v1.2333", ideally for checking if update is necessary
anyname := new Github("any_username/any_repo")
git := new Github("samfisherirl/github.ahk") ; example using this repository
```