Skip to content

Commit 8215a64

Browse files
committed
ci: add GitHub App auth and downstream repo triggers
Switches from GITHUB_TOKEN to GitHub App authentication to enable triggering workflows in downstream repositories. After updating price data, sends repository_dispatch events to indexers and accounting repos to trigger dependency updates.
1 parent c585cc6 commit 8215a64

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

.github/workflows/update-price-data.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@ jobs:
1111
steps:
1212
- name: Checkout repository
1313
uses: actions/checkout@v5
14+
15+
- name: Get app installation token
16+
id: app-token
17+
uses: actions/create-github-app-token@v2
1418
with:
15-
persist-credentials: true
19+
app-id: ${{ vars.APP_ID }}
20+
owner: ${{ github.repository_owner }}
21+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
22+
repositories: price-data,indexers,accounting
1623

1724
- name: Set up devkit
1825
uses: sablier-labs/devkit/actions/setup@main
@@ -31,7 +38,7 @@ jobs:
3138
run: just fetch-forex
3239

3340
- name: Verify changes
34-
run: |
41+
run: | #shell
3542
if ! git diff --quiet -- crypto/ forex/; then
3643
echo "✅ TSV files were updated"
3744
exit 0
@@ -45,16 +52,35 @@ jobs:
4552
run: echo "human=$(date '+%B %d, %Y at %H:%M UTC')" >> $GITHUB_OUTPUT
4653

4754
- name: Commit and push changes
48-
run: |
55+
env:
56+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
57+
run: | #shell
4958
git config --local user.email "github-actions[bot]@users.noreply.github.com"
5059
git config --local user.name "github-actions[bot]"
60+
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git
5161
git add crypto/ forex/
5262
git commit -m "chore: update price data - ${{ steps.timestamp.outputs.human }}"
5363
git push
5464
65+
- name: Trigger downstream updates
66+
env:
67+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
68+
run: | #shell
69+
gh api repos/sablier-labs/indexers/dispatches \
70+
-f event_type=price-data-updated \
71+
-f client_payload[timestamp]="${{ steps.timestamp.outputs.human }}"
72+
73+
gh api repos/sablier-labs/accounting/dispatches \
74+
-f event_type=price-data-updated \
75+
-f client_payload[timestamp]="${{ steps.timestamp.outputs.human }}"
76+
5577
- name: Add summary
56-
run: |
78+
run: | #shell
5779
echo "## Update result" >> $GITHUB_STEP_SUMMARY
5880
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
5981
echo "" >> $GITHUB_STEP_SUMMARY
6082
echo "Updated price data at ${{ steps.timestamp.outputs.human }}" >> $GITHUB_STEP_SUMMARY
83+
echo "" >> $GITHUB_STEP_SUMMARY
84+
echo "Triggered updates in:" >> $GITHUB_STEP_SUMMARY
85+
echo "- sablier-labs/indexers" >> $GITHUB_STEP_SUMMARY
86+
echo "- sablier-labs/accounting" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)