From 1cf07753ad109c9dcc4fd79e7c4201a101578f72 Mon Sep 17 00:00:00 2001 From: Andrea Lamparelli Date: Tue, 2 Apr 2024 17:19:50 +0200 Subject: [PATCH] Automate openapi changes notification to Horreum clients --- .github/workflows/notify-clients.yaml | 34 +++++++++++++++++++++++++++ docs/RELEASE.md | 11 +++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/notify-clients.yaml diff --git a/.github/workflows/notify-clients.yaml b/.github/workflows/notify-clients.yaml new file mode 100644 index 000000000..a458b4fcb --- /dev/null +++ b/.github/workflows/notify-clients.yaml @@ -0,0 +1,34 @@ +name: Notify clients + +on: + push: + branches: + - main + - 0.12.x + paths: + - "docs/site/content/en/openapi/openapi.yaml" + +jobs: + clients-notification: + runs-on: ubuntu-latest + strategy: + matrix: + clients: + - name: Golang + repository: Hyperfoil/horreum-client-golang + - name: Python + repository: Hyperfoil/horreum-client-python + + steps: + - name: Extract trigger branch + id: extractor + shell: bash + run: | + echo "current_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + - name: Notify ${{ matrix.clients.name }} client + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.CLIENTS_NOTIFICATION_TOKEN }} + repository: ${{ matrix.clients.repository }} + event-type: detected-horreum-openapi-change + client-payload: '{"branch": "${{ steps.extractor.outputs.current_branch }}"}' diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 3fdcb367b..a71db8cb1 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -150,6 +150,17 @@ on: workflow_dispatch: ``` +Update the Github action to notify openapi changes to the clients on every stable branch push: +```yaml +on: + push: + branches: + - main + - 0.12.x + paths: + - "docs/site/content/en/openapi/openapi.yaml" +``` + Commit the changes: ```bash