Is there any way to filter githubLatestTag? #3161
-
I'm having the following in my ".local/bin/notesnook.AppImage":
type: "file"
executable: true
url: "https://github.com/streetwriters/notesnook/releases/download/{{ (gitHubLatestRelease "streetwriters/notesnook").TagName }}/notesnook_linux_x86_64.AppImage"
refreshPeriod: "168h" It works fine for the most part, but fails sometimes. Indeed, this repository (streetwriters/notesnook) is a bit special since it provides both desktop and Android variants of the app mixed in the releases section. As a result, if the latest tag is for an Android version like right now:
❯ chezmoi apply
chezmoi: .local/bin/notesnook.AppImage: https://github.com/streetwriters/notesnook/releases/download/2.6.1-android/notesnook_linux_x86_64.AppImage: 404 Not Found Is there a way to filter the template in order to use the latest tag that doesn't contain With: url: "https://github.com/streetwriters/notesnook/releases/download/{{ (gitHubLatestRelease "streetwriters/notesnook").TagName | replaceAllRegex "-android" "" }}/notesnook_linux_x86_64.AppImage" I can get Any idea is appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
No, and I’m not sure that there would be an easy way to add one in since there’s no real "lambda" support in Go’s You could get something similar with a combination of the chezmoi execute-template '{{ (output "gh" "api" "repos/streetwriters/notesnook/releases" | fromJson | jq "map(select(.tag_name | endswith(\"-android\") | not))[0] | .assets | map(select(.name | contains(\"AppImage\")) | select(.name | contains(\"x86_64\")))" | first | first).browser_download_url }}' There is no caching with this option, though. It shouldn’t be hard to add |
Beta Was this translation helpful? Give feedback.
No, and I’m not sure that there would be an easy way to add one in since there’s no real "lambda" support in Go’s
text/template
.You could get something similar with a combination of the
output
,fromJson
, andjq
functions with thegh
command (you could usecurl
, too):chezmoi execute-template '{{ (output "gh" "api" "repos/streetwriters/notesnook/releases" | fromJson | jq "map(select(.tag_name | endswith(\"-android\") | not))[0] | .assets | map(select(.name | contains(\"AppImage\")) | select(.name | contains(\"x86_64\")))" | first | first).browser_download_url }}'
There is no caching with this option, though.
It shouldn’t be hard to add
githubTags
orgithubReleases
functions that does cach…