Skip to content

Commit

Permalink
chore(ci): add repository dispatch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant committed Apr 14, 2024
1 parent 8b6ee60 commit ff8fea6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/repository_dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Repository dispatch on main
on:
workflow_dispatch:
push:
branches:
- main

env:
BIOME_WEBSITE_REPO: biomejs/website
BIOME_PUSH_ON_MAIN_EVENT_TYPE: biome-push-on-main-event

jobs:
repository-dispatch:
name: Repository dispatch
runs-on: ubuntu-latest
steps:
- name: Dispatch event on push
if: ${{ github.event_name == 'push' }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }}
repository: ${{ env.BIOME_WEBSITE_REPO }}
event-type: ${{ env.BIOME_PUSH_ON_MAIN_EVENT_TYPE }}
client-payload: '{"event": ${{ toJson(github.event) }}}'
# For testing only, the payload is mocked
- name: Dispatch event on workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }}
repository: ${{ env.BIOME_WEBSITE_REPO }}
event-type: ${{ env.BIOME_PUSH_ON_MAIN_EVENT_TYPE }}
client-payload: '{"event": {"head_commit": {"id": "${{ env.GITHUB_SHA }}"}}}'

0 comments on commit ff8fea6

Please sign in to comment.