Skip to content

Commit

Permalink
Use GitHub action context for input
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Aug 6, 2024
1 parent 0d29f75 commit 2dccd34
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 24 deletions.
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
Expand Down Expand Up @@ -159,7 +158,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
Expand All @@ -169,25 +167,17 @@ jobs:
### Specify the input directory

To run the action for parameters not declared at the root of the repository,
set the parameter `input` to the directory of your `buf.yaml` file.
set the parameter `input` and `breaking_against` to include a subdir to the path
of your `buf.yaml` file. These parameters are configured as a base input ref.

```yaml
- uses: bufbuild/buf-action@v1
with:
input: <path/to/module>
```

Breaking change detection by default will use the `input` value as a subdirectory for the breaking against value.
To customize this behavior, set the parameter `breaking_against` to the desired input.

```yaml
- uses: bufbuild/buf-action@v1
with:
input: <path/to/module>
input: ${{ github.event.repository.clone_url }}#format=git,commit=${{ github.event.pull_request.head.sha }},subdir=<path/to/module>
breaking_against: ${{ github.event.repository.clone_url }}#format=git,commit=${{ github.event.pull_request.base.sha }},subdir=<path/to/module>
```

Alternatively, you can checkout the base for the breaking comparison to a local folder
Alternatively, you can checkout the head and base to a local folder
and then set the value of `breaking_against` to the path of the base.

```yaml
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ inputs:
description: |-
Input for the buf command.
required: false
default: ${{ github.event.repository.clone_url }}#format=git,commit=${{ github.event.pull_request.head.sha || github.event.head }}
paths:
description: |-
Limit to specific files or directories (separated by newlines).
Expand Down Expand Up @@ -112,6 +113,7 @@ inputs:
Input to compare against for breaking change detection.
Defaults to the base branch of the pull request or the commit before the push.
required: false
default: ${{ github.event.repository.clone_url }}#format=git,commit=${{ github.event.pull_request.base.sha || github.event.before }}

push:
description: |-
Expand Down
1 change: 0 additions & 1 deletion examples/disable-skip/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion examples/only-checks/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
1 change: 0 additions & 1 deletion examples/only-sync/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
1 change: 0 additions & 1 deletion examples/push-on-changes/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
1 change: 0 additions & 1 deletion examples/skip-on-commits/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion examples/skip-on-labels/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion examples/validate-push/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
# The token paramater is required to authenticate with the Buf Schema Registry.
Expand Down
1 change: 0 additions & 1 deletion examples/version-env/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
Expand Down
1 change: 0 additions & 1 deletion examples/version-input/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
Expand Down
1 change: 0 additions & 1 deletion examples/version-latest/buf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
Expand Down

0 comments on commit 2dccd34

Please sign in to comment.