Skip to content

Commit be32561

Browse files
authored
ci: notify gateway when template assets change (#166)
1 parent 2dbd61a commit be32561

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Notify gateway of template asset updates
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'examples/**'
9+
- '.github/workflows/notify-gateway-template-assets-update.yml'
10+
workflow_dispatch:
11+
inputs:
12+
statespace_sha:
13+
description: Optional statespace commit SHA to publish from (defaults to current commit)
14+
required: false
15+
type: string
16+
17+
permissions: {}
18+
19+
jobs:
20+
dispatch-gateway:
21+
name: Dispatch template update to gateway
22+
runs-on: blacksmith-4vcpu-ubuntu-2204
23+
steps:
24+
- name: Resolve statespace commit SHA
25+
id: sha
26+
run: |
27+
set -euo pipefail
28+
29+
target_sha="${{ github.event.inputs.statespace_sha }}"
30+
if [[ -z "${target_sha}" ]]; then
31+
target_sha="${{ github.sha }}"
32+
fi
33+
34+
if [[ ! "$target_sha" =~ ^[0-9a-f]{40}$ ]]; then
35+
echo "::error::statespace_sha must be a full 40-character commit SHA"
36+
exit 1
37+
fi
38+
39+
echo "value=$target_sha" >> "$GITHUB_OUTPUT"
40+
41+
- name: Send repository_dispatch event to gateway
42+
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0
43+
with:
44+
token: ${{ secrets.GATEWAY_REPO_DISPATCH_TOKEN }}
45+
repository: statespace-tech/gateway
46+
event-type: statespace-template-assets-updated
47+
client-payload: >-
48+
{"statespace_sha":"${{ steps.sha.outputs.value }}","statespace_ref":"${{ github.ref_name }}","source_run_id":"${{ github.run_id }}"}

0 commit comments

Comments
 (0)