Infer some values for Github Release
Having used this action a few times now, I think there's some possibility to make the action a bit less boilerplate-y.
Specifically, if the user specifies a urlTemplate that matches ^https:\/\/github\.com\/(?<repo>.*\/.*)\/releases\/download\/, infer the following:
fromGithubReleases: true
repo: <repo from regex>
version: latest
So that this:
- uses: engineerd/[email protected]
with:
name: "kind"
fromGitHubReleases: "true"
repo: "kubernetes-sigs/kind"
urlTemplate: "https://github.com/kubernetes-sigs/kind/releases/download/{{version}}/kind-linux-amd64"
version: "latest"
token: ${{ secrets.GITHUB_TOKEN }}
would become this:
- uses: engineerd/[email protected]
with:
name: "kind"
urlTemplate: "https://github.com/kubernetes-sigs/kind/releases/download/{{version}}/kind-linux-amd64"
token: ${{ secrets.GITHUB_TOKEN }}
Hi, and thanks for opening this issue!
Why would version automatically become "latest"?
Mostly to have a default in place, though I'd be fine leaving that out to force consumers to think about versioning and pinning the version.
Ok, that makes sense. As long as it's clear in the documentation (readme for now) that the URL location and repository can be disconnected (i.e. in a lot of cases, the binary assets are stored in some cloud accounts), I'm ok with this change.
Would you be interested in contributing? I'm happy to help / review, but it would probably take me a few weeks to get back to adding this.
The changes seem to be when we make the decision to get a GitHub release -- here we would change the condition to test for a urlTemplate as well, then try to infer the GitHub repository:
https://github.com/engineerd/configurator/blob/94e10ecef5d996565e35a78795802d8bd86f8fb2/src/configurator.ts#L75-L81
I can def contribute that :)
Done! Lmk if it looks good: https://github.com/engineerd/configurator/pull/30