Skip to content

feat: update API specifications (#61) #33

feat: update API specifications (#61)

feat: update API specifications (#61) #33

Workflow file for this run

name: Sync to Fern Repository
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "openapi.yml"
- "asyncapi.yml"
jobs:
publish-file:
runs-on: ubuntu-latest
steps:
- name: Check out the source repository
uses: actions/checkout@v2
- name: Load date value
id: date
run: echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Clone the target repository
env:
TARGET_REPO_TOKEN: ${{ secrets.FERN_PRS }}
run: |
if [ -z "$TARGET_REPO_TOKEN" ]; then
echo "Error: TARGET_REPO_TOKEN is not set"
exit 1
fi
USERNAME=$(curl -s -H "Authorization: token ${TARGET_REPO_TOKEN}" https://api.github.com/user | jq -r '.login')
echo "Authenticated as $USERNAME"
git clone https://${TARGET_REPO_TOKEN}@github.com/deepgram/deepgram-docs.git
cd deepgram-docs
# Create a new branch for the PR
BRANCH_NAME="update-specs-${{ steps.date.outputs.date }}" # Using timestamp format
git checkout -b $BRANCH_NAME
echo "Checked out $BRANCH_NAME"
# Copy both spec files
cp ../openapi.yml ./fern/openapi.yml
cp ../asyncapi.yml ./fern/asyncapi.yml
git add ./fern/openapi.yml ./fern/asyncapi.yml
echo "Staged files"
git commit -m "feat: update API specifications"
echo "Committed Files"
git push https://${TARGET_REPO_TOKEN}@github.com/deepgram/deepgram-docs.git $BRANCH_NAME
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.FERN_PRS }}
run: |
gh pr create \
--repo deepgram/deepgram-docs \
--title "feat: update API specifications" \
--body "This PR updates both OpenAPI and AsyncAPI specifications from the main branch of deepgram-api-specs." \
--base main \
--head "update-specs-${{ steps.date.outputs.date }}"