Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer some values for Github Release #29

Open
RichiCoder1 opened this issue Jul 15, 2021 · 5 comments
Open

Infer some values for Github Release #29

RichiCoder1 opened this issue Jul 15, 2021 · 5 comments

Comments

@RichiCoder1
Copy link

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/configurator@v0.0.8
        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/configurator@v0.0.8
        with:
          name: "kind"
          urlTemplate: "https://github.com/kubernetes-sigs/kind/releases/download/{{version}}/kind-linux-amd64"
          token: ${{ secrets.GITHUB_TOKEN }}
@radu-matei
Copy link
Member

Hi, and thanks for opening this issue!

Why would version automatically become "latest"?

@RichiCoder1
Copy link
Author

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.

@radu-matei
Copy link
Member

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:

if (this.fromGitHubReleases) {
let tag = await getTag(
this.token,
this.repo,
this.version,
this.includePrereleases
);

@RichiCoder1
Copy link
Author

I can def contribute that :)

@RichiCoder1
Copy link
Author

Done! Lmk if it looks good: #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants