Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 71 additions & 71 deletions .github/workflows/rdme-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,81 +10,81 @@ name: Generate ReadMe Staging 🦉
# - '.github/actions/**'
# - '.github/workflows/rdme-staging.yml'

jobs:
# ////////////////////////////////////////////////////////////////////////
# Pull Request
# ////////////////////////////////////////////////////////////////////////
# jobs:
# # ////////////////////////////////////////////////////////////////////////
# # Pull Request
# # ////////////////////////////////////////////////////////////////////////

# Create a new ReadMe Version if it needs to and pushes content to the version
rdme-staging:
if: ${{ github.event.pull_request.head.repo.full_name == 'mixpanel/docs' }}
runs-on: ubuntu-latest
steps:
- name: Check out repo 📚
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- run: npm ci
- name: Add node_modules to PATH
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
# # Create a new ReadMe Version if it needs to and pushes content to the version
# rdme-staging:
# if: ${{ github.event.pull_request.head.repo.full_name == 'mixpanel/docs' }}
# runs-on: ubuntu-latest
# steps:
# - name: Check out repo 📚
# uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# cache: 'npm'
# - run: npm ci
# - name: Add node_modules to PATH
# run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH

# Try to create the readme version, if it errors it's ok we keep going since it was already created
- name: Create readme version
run: |
if rdme versions:create 0.0-pr-${{ github.event.number }} --key=${{ secrets.README_API_KEY }} --fork=v3.26 --main=false --beta=false --deprecated=false --isPublic=true; then
echo "Version created successfully"
else
echo "Errors because the version already exists, and so we can continue to the next step"
fi
# # Try to create the readme version, if it errors it's ok we keep going since it was already created
# - name: Create readme version
# run: |
# if rdme versions:create 0.0-pr-${{ github.event.number }} --key=${{ secrets.README_API_KEY }} --fork=v3.26 --main=false --beta=false --deprecated=false --isPublic=true; then
# echo "Version created successfully"
# else
# echo "Errors because the version already exists, and so we can continue to the next step"
# fi

- name: Push docs to staging env 🚀
uses: readmeio/rdme@v8
with:
rdme: docs ./reference --key=${{ secrets.README_API_KEY }} --version=0.0-pr-${{ github.event.number }}
# - name: Push docs to staging env 🚀
# uses: readmeio/rdme@v8
# with:
# rdme: docs ./reference --key=${{ secrets.README_API_KEY }} --version=0.0-pr-${{ github.event.number }}

# Push openapi specs to staging env
- run: npm run api:build
- run: npm run api:publish
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
README_VERSION: 0.0-pr-${{ github.event.number }}
# # Push openapi specs to staging env
# - run: npm run api:build
# - run: npm run api:publish
# env:
# README_API_KEY: ${{ secrets.README_API_KEY }}
# README_VERSION: 0.0-pr-${{ github.event.number }}

# build and update comment with the proper link
preview-notify:
name: Preview / Notify
runs-on: ubuntu-latest
needs:
- rdme-staging
timeout-minutes: 15
permissions:
contents: read
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
reference
# # build and update comment with the proper link
# preview-notify:
# name: Preview / Notify
# runs-on: ubuntu-latest
# needs:
# - rdme-staging
# timeout-minutes: 15
# permissions:
# contents: read
# issues: write
# pull-requests: write
# steps:
# - uses: actions/checkout@v4
# with:
# sparse-checkout: |
# .github
# reference

# Build PR Comment
- name: Build PR comment
id: build-pr-comment
uses: actions/github-script@v8
with:
result-encoding: string
script: |
return `
# API Reference Preview
:rocket: https://developer.mixpanel.com/v0.0-pr-${{ github.event.number }}/reference/overview
Last updated: ${new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"})} PT from ${{github.sha}}
`
# # Build PR Comment
# - name: Build PR comment
# id: build-pr-comment
# uses: actions/github-script@v8
# with:
# result-encoding: string
# script: |
# return `
# # API Reference Preview
# :rocket: https://developer.mixpanel.com/v0.0-pr-${{ github.event.number }}/reference/overview
# Last updated: ${new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"})} PT from ${{github.sha}}
# `

# Update PR Comment
- uses: ./.github/actions/create-or-update-comment
with:
issue-number: ${{ github.event.number }}
key: reference-pr-preview
body: ${{ steps.build-pr-comment.outputs.result }}
# # Update PR Comment
# - uses: ./.github/actions/create-or-update-comment
# with:
# issue-number: ${{ github.event.number }}
# key: reference-pr-preview
# body: ${{ steps.build-pr-comment.outputs.result }}