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

Allow configuring the buf remote #121

Merged
merged 1 commit into from
Apr 11, 2023
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ You can configure `buf-setup-action` with these parameters:
| `github_token` | The GitHub token to use when making API requests | |
| `buf_user` | The username to use for logging into Buf Schema registry. | |
| `buf_api_token` | The API token to use for logging into Buf Schema registry. | |
| `buf_domain` | The domain of the Buf Schema Registry to login to. | buf.build |
Copy link
Member

Choose a reason for hiding this comment

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

buf_instance?


> These parameters are derived from [`action.yml`](./action.yml). <br>
#### Version
Expand Down Expand Up @@ -117,6 +118,12 @@ Note that this only authenticate you with the `buf` cli. You cannot access your
packages in BSR. If you need to access your private remote packages, supply the username and Buf
API Token [as parameters](#buf-username-and-buf-api-token).

#### Buf domain

If you are working with a private BSR then you can set the `buf_domain` input to the domain of
your instance. Please ensure that you are using a token created on your instance (e.g. `https://buf.example.com/settings/user`) and not from the public BSR at `https://buf.build`.


#### Installing `protoc`

In most cases, you _don't_ need to install [`protoc`][protoc] for Buf's GitHub Actions, but some
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ inputs:
buf_api_token:
description: The API token to use for logging into Buf Schema registry.
required: false
buf_domain:
description: The domain of the Buf Schema Registry to login to.
required: false
default: 'buf.build'
runs:
using: "node16"
main: "./dist/main.js"
2 changes: 1 addition & 1 deletion dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/main.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ async function runSetup(): Promise<null | Error> {
core.info(`Successfully setup buf version ${version}`);
core.info(cp.execSync(`${binaryPath} --version`).toString());

const bufDomain = core.getInput("buf_domain");
const bufUser = core.getInput("buf_user");
const bufAPIToken = core.getInput("buf_api_token");
if (bufUser !== "" && bufAPIToken !== "") {
core.info(`buf_user and buf_token supplied, logging in...`);
core.info(
cp
.execSync(
`${binaryPath} registry login --username ${bufUser} --token-stdin`,
`${binaryPath} registry login ${bufDomain} --username ${bufUser} --token-stdin`,
{ input: bufAPIToken }
)
.toString()
Expand Down