diff --git a/.github/workflows/dispatch-sdk-updates.yml b/.github/workflows/dispatch-sdk-updates.yml new file mode 100644 index 0000000..77a0bc2 --- /dev/null +++ b/.github/workflows/dispatch-sdk-updates.yml @@ -0,0 +1,38 @@ +name: Notify SDKs of published spec updates + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + dispatch: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + repository: + - braintrust-sdk-rust + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Create scoped notification token + id: bot + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + app-id: ${{ vars.SDK_DISPATCH_APP_ID }} + private-key: ${{ secrets.SDK_DISPATCH_APP_PRIVATE_KEY }} + owner: braintrustdata + repositories: ${{ matrix.repository }} + permission-contents: write + - name: Notify SDK receiver + env: + GH_TOKEN: ${{ steps.bot.outputs.token }} + SDK_REPOSITORY: ${{ matrix.repository }} + run: | + set -euo pipefail + gh api --method POST "repos/braintrustdata/$SDK_REPOSITORY/dispatches" \ + -f event_type=braintrust-openapi-updated