Skip to content

Trigger Redeploy

Trigger Redeploy #627

name: Trigger Redeploy
on:
workflow_dispatch:
inputs:
reason:
description: 'Reason for redeployment (optional)'
required: false
default: 'Manual trigger'
push:
paths:
- 'scripts/openapi-capitalize-language.mjs'
- 'scripts/openapi-split-break-circular.mjs'
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
trigger-redeploy:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check-generated.outputs.has_changes }}
steps:
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Set up mise
uses: jdx/mise-action@v4
with:
cache: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Regenerate OpenAPI documentation
run: |
echo "πŸ“‹ Regenerating OpenAPI documentation..."
echo "Reason: ${{ github.event.inputs.reason }}"
pnpm openapi:regenerate:all
echo "βœ… Documentation regenerated successfully"
- name: Format generated files
run: pnpm prettier --write .
- name: Check for generated changes
id: check-generated
run: |
# Ignore src/data and static/deprecations because they will both
# include timestamps that generate false positives to the question:
# "are there differences to deploy".
if [[ -n $(git status --porcelain -- ':!src/data/**' ':!static/deprecations.xml') ]]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "πŸ“ Changes detected in generated documentation"
else
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "βœ… No changes in generated documentation"
fi
- name: Create Pull Request
if: steps.check-generated.outputs.has_changes == 'true'
id: create-pr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: 'chore: regenerate OpenAPI documentation'
title: 'Regenerate OpenAPI Documentation'
body: |
## πŸ”„ OpenAPI Documentation Regeneration
**Trigger reason**: ${{ github.event.inputs.reason }}
**Triggered by**: ${{ github.actor }}
**Run ID**: [${{ github.run_id }}](https://github.com/gleanwork/glean-developer-site/actions/runs/${{ github.run_id }})
### Actions taken:
- Downloaded latest OpenAPI specs from GitHub Pages
- Split client API by tags
- Resolved circular references
- Capitalized language names in code samples
- Regenerated all MDX documentation
- Cleaned up unnecessary files (.info.mdx, sidebar.ts)
### Files affected:
- `openapi/` - Updated spec files
- `docs/api/client-api/` - Regenerated client API docs
- `docs/api/indexing-api/` - Regenerated indexing API docs
Please review the changes if needed, otherwise the PR will auto-merge when checks pass.
branch: ci/regenerate-openapi-docs
delete-branch: true
- name: Enable Auto-Merge
if: steps.check-generated.outputs.has_changes == 'true'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ steps.app-token.outputs.token }}
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
merge-method: squash
summary:
runs-on: ubuntu-latest
needs: trigger-redeploy
steps:
- name: Print Summary
run: |
if [[ "${{ needs.trigger-redeploy.outputs.has_changes }}" == "true" ]]; then
echo "πŸŽ‰ Documentation regenerated and PR created with auto-merge enabled!"
else
echo "βœ… Documentation is already up to date - no changes needed"
fi