{"id":29343616,"url":"https://github.com/bufbuild/buf-push-action","last_synced_at":"2025-07-08T12:11:09.380Z","repository":{"id":40424673,"uuid":"348845654","full_name":"bufbuild/buf-push-action","owner":"bufbuild","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-12T21:30:18.000Z","size":404,"stargazers_count":15,"open_issues_count":0,"forks_count":6,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-06-30T21:08:21.840Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bufbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-17T20:38:35.000Z","updated_at":"2025-04-14T03:46:17.000Z","dependencies_parsed_at":"2023-11-13T20:26:14.380Z","dependency_job_id":"80422009-dd66-486f-b356-a5d5bd307578","html_url":"https://github.com/bufbuild/buf-push-action","commit_stats":{"total_commits":33,"total_committers":11,"mean_commits":3.0,"dds":"0.48484848484848486","last_synced_commit":"08bc635bc8bacacc7a1fce163e9d782c1a452cf3"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/bufbuild/buf-push-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fbuf-push-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fbuf-push-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fbuf-push-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fbuf-push-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufbuild","download_url":"https://codeload.github.com/bufbuild/buf-push-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fbuf-push-action/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264267170,"owners_count":23581933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-08T12:11:07.235Z","updated_at":"2025-07-08T12:11:09.375Z","avatar_url":"https://github.com/bufbuild.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `buf-push-action`\n\n\u003e [!NOTE]\n\u003e This action has been deprecated in favor of the [`buf-action`][buf-action] which combines the\n\u003e functionality of `buf-push-action` with the ability to run Buf commands in the same step. Please\n\u003e see the [migration guide][buf-action-migration] for more information.\n\nThis Action enables you to push [Buf modules][modules] to the [Buf Schema Registry][bsr] (BSR)\nPushed modules are created with the Git commit SHA as the module tag.\n\n`buf-push-action` is frequently used alongside other Buf Actions, such as\n[`buf-breaking-action`][buf-breaking] and [`buf-lint-action`][buf-lint].\n\n## Usage\n\nHere's an example usage of `buf-push-action`:\n\n```yaml\non: push # Apply to all push\njobs:\n  push-module:\n    runs-on: ubuntu-latest\n    steps:\n      # Run `git checkout`\n      - uses: actions/checkout@v2\n      # Install the `buf` CLI\n      - uses: bufbuild/buf-setup-action@v1\n      # Push module to the BSR\n      - uses: bufbuild/buf-push-action@v1\n        with:\n          buf_token: ${{ secrets.BUF_TOKEN }}\n          create_visibility: private\n          draft: ${{ github.ref_name != 'main'}}\n```\n\nWith this configuration, upon a push [branches, tags][github-workflow]\nthe `buf` CLI pushes the [configured module][buf-yaml] to the BSR using the provided to\nauthenticate the request. If the repository does not already exist on the BSR, create it\nwith private visibility. When the triggering branch is not `main`, the commit will be pushed\nas a [draft][buf-draft].\n\nFor instructions on creating a BSR API token, see our [official docs][bsr-token]. Once you've\ncreated a an API token, you need to create an encrypted [Github Secret][github-secret] for it. In\nthis example, the API token is set to the `BUF_TOKEN` secret.\n\n## Prerequisites\n\nFor `buf-push-action` to run, you need to install the `buf` CLI in the GitHub Actions Runner first.\nWe recommend using [`buf-setup-action`][buf-setup] to install it (as in the example above).\n\n## Configuration\n\n| Parameter           | Description                                                                    | Required | Default                             |\n| :------------------ | :----------------------------------------------------------------------------- | :------- | :---------------------------------- |\n| `buf_token`         | The [Buf authentication token][buf-token] used for private [Buf inputs][input] | ✅       | [`${{github.token}}`][github-token] |\n| `input`             | The path of the [input] you want to push to BSR as a module                    |          | `.`                                 |\n| `draft`             | Indicates if the workflows should push to the BSR as a [draft][buf-draft]      |          |                                     |\n| `create_visibility` | The visibility to create the BSR repository with, if it does not already exist |          |                                     |\n\n\u003e These parameters are derived from [`action.yml`](./action.yml).\n\n## Common tasks\n\n### Run against input in sub-directory\n\nSome repositories are structured so that their [`buf.yaml`][buf-yaml] configuration file is defined\nin a sub-directory alongside their Protobuf sources, such as a `proto` directory. Here's an example:\n\n```sh\n$ tree\n.\n└── proto\n    ├── acme\n    │   └── weather\n    │       └── v1\n    │           └── weather.proto\n    └── buf.yaml\n```\n\nIn that case, you can target the `proto` sub-directory by setting `input` to `proto`:\n\n```yaml\nsteps:\n  # Run `git checkout`\n  - uses: actions/checkout@v2\n  # Install the `buf` CLI\n  - uses: bufbuild/buf-setup-action@v1\n  # Push only the Input in `proto` to the BSR\n  - uses: bufbuild/buf-push-action@v1\n    with:\n      input: proto\n      buf_token: ${{ secrets.BUF_TOKEN }}\n```\n\n### Push multiple modules\n\nIf you have multiple modules defined in your repository, you'll need to configure `buf-push-action`\nfor each of the modules you want to push.\n\nFor example, suppose you have the following `buf.work.yaml`:\n\n```yaml\nversion: v1\ndirectories:\n  - petapis\n  - paymentapis\n```\n\nIf you want to push both of the modules defined in the `paymentapis` and `petapis` directories,\nyou could adapt the workflow above like so (replacing the `proto` directory input with the\nhypothetical `paymentapis` and `petapis` directory inputs):\n\n```yaml\nsteps:\n  # Run `git checkout`\n  - uses: actions/checkout@v2\n  # Install the `buf` CLI\n  - uses: bufbuild/buf-setup-action@v1\n  # Push only the Input in `paymentapis` to the BSR\n  - uses: bufbuild/buf-push-action@v1\n    with:\n      input: paymentapis\n      buf_token: ${{ secrets.BUF_TOKEN }}\n  # Push only the Input in `petapis` to the BSR\n  - uses: bufbuild/buf-push-action@v1\n    with:\n      input: petapis\n      buf_token: ${{ secrets.BUF_TOKEN }}\n```\n\nNote, if any of the modules defined in your workspace depend on each other, you usually need to\nrun `buf mod update` so that the downstream module uses the upstream module's latest commit. This\nis not supported by `buf-push-action` on its own - you'll need to stitch this functionality into\nyour workflow on your own. For more details, see [this](https://github.com/bufbuild/buf/issues/838)\ndiscussion.\n\n### Validate before push\n\n`buf-push-action` is typically used alongside other `buf` Actions, such as\n[`buf-breaking-action`][buf-breaking] and [`buf-lint-action`][buf-lint]. A common use case is to\n\"validate\" a Buf module before pushing it to the [BSR] by ensuring that it passes both\n[lint] and [breaking change][breaking] checks, as in this example:\n\n```yaml\non: # Apply to all pushes to `main`\n  push:\n    branches:\n      - main\njobs:\n  validate-and-push-protos:\n    runs-on: ubuntu-latest\n    steps:\n      # Run `git checkout`\n      - uses: actions/checkout@v2\n      # Install the `buf` CLI\n      - uses: bufbuild/buf-setup-action@v1\n      # Run a lint check on Protobuf sources\n      - uses: bufbuild/buf-lint-action@v1\n      # Run breaking change detection for Protobuf sources against the current `main` branch\n      - uses: bufbuild/buf-breaking-action@v1\n        with:\n          against: https://github.com/acme/weather.git#branch=main,ref=HEAD~1,subdir=proto\n      # Push the validated module to the BSR\n      - uses: bufbuild/buf-push-action@v1\n        with:\n          buf_token: ${{ secrets.BUF_TOKEN }}\n```\n\n[buf-action]: https://github.com/bufbuild/buf-action\n[buf-action-migration]: https://github.com/bufbuild/buf-action/blob/main/MIGRATION.md#buf-push-action\n[breaking]: https://docs.buf.build/breaking\n[bsr]: https://docs.buf.build/bsr\n[bsr-token]: https://docs.buf.build/bsr/authentication\n[buf-breaking]: https://github.com/marketplace/actions/buf-breaking\n[buf-draft]: https://docs.buf.build/bsr/overview#referencing-a-module\n[buf-lint]: https://github.com/marketplace/actions/buf-lint\n[buf-setup]: https://github.com/marketplace/actions/buf-setup\n[buf-token]: https://docs.buf.build/bsr/authentication#create-an-api-token\n[buf-yaml]: https://docs.buf.build/configuration/v1/buf-yaml\n[github-secret]: https://docs.github.com/en/actions/reference/encrypted-secrets\n[github-token]: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context\n[github-workflow]: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push\n[input]: https://docs.buf.build/reference/inputs\n[lint]: https://docs.buf.build/lint\n[modules]: https://docs.buf.build/bsr/overview#module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Fbuf-push-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufbuild%2Fbuf-push-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Fbuf-push-action/lists"}