feat: update API specifications from internal repo (#116) #84
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # This workflow implements a "repository dispatch" pattern for syncing API specifications | |
| # between the source repo (deepgram-api-specs) and target repo (deepgram-docs). | |
| name: Dispatch API Spec Updates | |
| on: | |
| # Allow manual triggering for testing | |
| workflow_dispatch: | |
| # Trigger when API specs are updated on main branch | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "openapi.yml" | |
| - "asyncapi.yml" | |
| jobs: | |
| dispatch-update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out the source repository to access commit information | |
| - name: Check out the source repository | |
| uses: actions/checkout@v4 | |
| # Generate a timestamp for unique branch naming in the target repo | |
| - name: Load date value | |
| id: date | |
| run: echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
| # Send a repository dispatch event to the target repo | |
| - name: Dispatch repository event | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| # Token with 'repo' scope to dispatch events to other repositories | |
| # This token is stored in GitHub Secrets and should have minimal permissions | |
| token: ${{ secrets.SPECS_DISPATCH_TOKEN }} | |
| # The target repository that will receive the event | |
| repository: deepgram/deepgram-docs | |
| # Custom event type - the target repo listens for this specific event | |
| event-type: update-api-specs | |
| # Payload sent to the target repo with context about the change | |
| client-payload: | | |
| { | |
| "timestamp": "${{ steps.date.outputs.date }}", | |
| "source_repo": "${{ github.repository }}", | |
| "commit_sha": "${{ github.sha }}" | |
| } |