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

Make default version explicit #12

Merged
merged 2 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Install and setup [buf](https://github.com/bufbuild/buf) for use in other action
Refer to the [action.yml](https://github.com/bufbuild/buf-setup-action/blob/main/action.yml)
to see all of the action parameters.

If `version` is unspecified, it will be defaulted to `latest`.
If `version` is unspecified, the default value is set to the latest `buf` version:

```yaml
steps:
Expand All @@ -16,6 +16,28 @@ steps:
- run: buf --version
```

If you want to pin to a specific version, vou can explicitly set it like so:

```yaml
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v0.4.0
with:
version: '0.56.0'
- run: buf --version
```

If you want to explicitly set `buf` to its latest release, vou can set it like so:

```yaml
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v0.4.0
with:
version: 'latest'
- run: buf --version
```

The `buf-setup` action is commonly used by the other `buf` actions,
such as [buf-breaking][1], [buf-lint][2], and [buf-push][3].

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branding:
inputs:
version:
description: 'The version of buf to setup.'
default: 'latest'
default: '0.56.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the approach here would be "maxing out the latest" to 0.56.0, for example, right? E.g. without upgrading the setup action, you're basically restricted to this maximum version, but users can explicitly set the version input to latest to go beyond this version, right? I am okay with this user experience, so I am going to stamp this, but we may want to call out setting latest explicitly as a supported behaviour in the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I agree that we should update the README.md with the ability to set latest. I'll include a note here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also to be clear, users aren't "maxed out" by the setting - they can still explicitly set a version that's higher than 0.56.0.

runs:
using: 'node12'
main: './dist/main.js'
4 changes: 2 additions & 2 deletions dist/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/main.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ export async function run(): Promise<void> {
// runSetup runs the buf-setup action, and returns
// a non-empty error if it fails.
async function runSetup(): Promise<null|Error> {
let version = core.getInput('version');
const version = core.getInput('version');
if (version === '') {
// If version is not provided, default to 'latest'.
version = 'latest'
return {
message: 'a version was not provided'
};
}

core.info(`Setting up buf version "${version}"`);
Expand Down