Skip to content

Commit

Permalink
Make default version explicit (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
amckinney committed Sep 15, 2021
1 parent 8fb5ea2 commit e828f8f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
24 changes: 23 additions & 1 deletion README.md
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
Expand Up @@ -7,7 +7,7 @@ branding:
inputs:
version:
description: 'The version of buf to setup.'
default: 'latest'
default: '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
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

0 comments on commit e828f8f

Please sign in to comment.