Skip to content

Commit

Permalink
Merge pull request #19 from authzed/update-api-and-add-api-update-logic
Browse files Browse the repository at this point in the history
Update api and add api update logic
  • Loading branch information
tstirrat15 authored Nov 4, 2024
2 parents c519177 + fba6ca7 commit f7a938b
Show file tree
Hide file tree
Showing 21 changed files with 2,621 additions and 658 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/automatic-api-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Called update for API change"
on:
repository_dispatch:
types: ["api_update"]
jobs:
test:
name: "Create PR for API update"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: "Update Buf Script"
id: buf-update
uses: authzed/actions/buf-api-update@main
with:
api-commit: "${{ github.event.client_payload.BUFTAG }}"
spec-path: buf.gen.yaml
file-format: "buf-gen-yaml"
- name: "Output update status"
env:
UPDATED_STATUS: ${{ steps.buf-update.outputs.updated }}
run: |
echo "Update status: $UPDATED_STATUS"
- name: "Install buf"
uses: "bufbuild/buf-setup-action@v1.43.0"
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: steps.buf-update.outputs.updated == 'true'
- name: "Run buf generate"
if: steps.buf-update.outputs.updated == 'true'
run: "buf generate"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.5
if: steps.buf-update.outputs.updated == 'true'
with:
delete-branch: "true"
title: "Update API to ${{ github.event.client_payload.BUFTAG }}"
branch: "api-change/${{ github.event.client_payload.BUFTAG }}"
base: "main"
token: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/manual-api-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Update for API change
on:
workflow_dispatch:
inputs:
buftag:
description: Tag or commit from https://buf.build/authzed/api/tags/main
required: true
type: string
jobs:
test:
name: "Create PR for API update"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: "Update Buf Script"
id: buf-update
uses: authzed/actions/buf-api-update@main
with:
api-commit: ${{ inputs.buftag }}
spec-path: buf.gen.yaml
file-format: "buf-gen-yaml"
- name: "Output update status"
env:
UPDATED_STATUS: ${{ steps.buf-update.outputs.updated }}
run: |
echo "Update status: $UPDATED_STATUS"
- name: "Install buf"
uses: "bufbuild/buf-setup-action@v1.43.0"
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: steps.buf-update.outputs.updated == 'true'
- name: "Run buf generate"
if: steps.buf-update.outputs.updated == 'true'
run: "buf generate"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.5
if: steps.buf-update.outputs.updated == 'true'
with:
delete-branch: "true"
title: Update API to ${{ inputs.buftag }}
branch: api-change/${{ inputs.buftag }}
base: "main"
token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 3 additions & 7 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
# yamllint disable rule:line-length
version: "v2"
plugins:
- protoc_builtin: "csharp"
- remote: "buf.build/protocolbuffers/csharp:v28.3"
out: "src/Authzed.Net"
opt: "base_namespace="
include_imports: true
# TODO: this is arch-specific and may be host-specific as well (in terms of where .nuget is)
# NOTE: part of the reason this is a pain is that the csharp ecosystem expects you to use
# the dotnet toolchain from top-to-bottom to compile protoc, so feeding things through buf
# and using a local plugin isn't in their use case.
- local: "/home/tstirrat/.nuget/packages/grpc.tools/2.65.0/tools/linux_x64/grpc_csharp_plugin"
- remote: "buf.build/grpc/csharp:v1.67.1"
out: "src/Authzed.Net"
opt:
- "base_namespace="
- "no_server=on"
inputs:
- module: buf.build/authzed/api:v1.37.0
- module: buf.build/authzed/api:v1.38.0
52 changes: 44 additions & 8 deletions src/Authzed.Net/Authzed/Api/Materialize/V0/Watchpermissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static WatchpermissionsReflection() {

}
#region Messages
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class WatchPermissionsRequest : pb::IMessage<WatchPermissionsRequest>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -253,7 +254,11 @@ public void MergeFrom(pb::CodedInputStream input) {
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
Expand All @@ -279,7 +284,11 @@ public void MergeFrom(pb::CodedInputStream input) {
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
Expand All @@ -301,6 +310,7 @@ public void MergeFrom(pb::CodedInputStream input) {

}

[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class WatchedPermission : pb::IMessage<WatchedPermission>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -555,7 +565,11 @@ public void MergeFrom(pb::CodedInputStream input) {
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
Expand Down Expand Up @@ -586,7 +600,11 @@ public void MergeFrom(pb::CodedInputStream input) {
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
Expand All @@ -613,6 +631,7 @@ public void MergeFrom(pb::CodedInputStream input) {

}

[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class WatchPermissionsResponse : pb::IMessage<WatchPermissionsResponse>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -850,7 +869,11 @@ public void MergeFrom(pb::CodedInputStream input) {
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
Expand Down Expand Up @@ -883,7 +906,11 @@ public void MergeFrom(pb::CodedInputStream input) {
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
Expand Down Expand Up @@ -912,6 +939,7 @@ public void MergeFrom(pb::CodedInputStream input) {

}

[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class PermissionChange : pb::IMessage<PermissionChange>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -1207,7 +1235,11 @@ public void MergeFrom(pb::CodedInputStream input) {
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
Expand Down Expand Up @@ -1251,7 +1283,11 @@ public void MergeFrom(pb::CodedInputStream input) {
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
Expand Down
Loading

0 comments on commit f7a938b

Please sign in to comment.