Clean All Generated Content #65
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
| name: Clean All Generated Content | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| confirm: | |
| description: 'Type "yes" to confirm deletion of generated content' | |
| required: true | |
| default: "no" | |
| type: choice | |
| options: | |
| - "no" | |
| - "yes" | |
| # Prevent concurrent content updates to avoid conflicts | |
| concurrency: | |
| group: "content-branch-updates" | |
| cancel-in-progress: false | |
| jobs: | |
| clean-generated: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout content branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: content | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Validate confirmation | |
| run: | | |
| if [ "${{ github.event.inputs.confirm }}" != "yes" ]; then | |
| echo "❌ Confirmation not provided. Operation cancelled." | |
| echo "To proceed, set the 'confirm' input to 'yes'" | |
| exit 1 | |
| fi | |
| echo "✅ Confirmation received. Proceeding with cleanup..." | |
| - name: Clean generated content | |
| run: bun run clean:generated --confirm=yes | |
| - name: Commit cleanup results | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| # Stage all changes from the cleanup | |
| git add . | |
| # Commit if there are changes | |
| git diff --cached --quiet || git commit -m "(content-cleanup): remove all generated content from Notion" | |
| # Push to content branch | |
| git push origin content | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Show cleanup results | |
| run: | | |
| echo "🧹 Generated content cleanup completed" | |
| echo "📁 Remaining structure:" | |
| ls -la docs/ || echo "No docs directory" | |
| ls -la i18n/*/docusaurus-plugin-content-docs/current/ || echo "No i18n content directories" | |
| - name: Notify Slack | |
| if: always() | |
| uses: slackapi/[email protected] | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| text: "*Generated content cleanup*: ${{ job.status }}" | |
| blocks: | |
| - type: "section" | |
| text: | |
| type: "mrkdwn" | |
| text: "*Generated content cleanup*: ${{ job.status }}\nConfirm flag: `${{ github.event.inputs.confirm }}`" | |
| - type: "section" | |
| text: | |
| type: "mrkdwn" | |
| text: "Content branch: `content`\nTrigger: <https://github.com/${{ github.triggering_actor }}|${{ github.triggering_actor }}>" | |
| - type: "section" | |
| text: | |
| type: "mrkdwn" | |
| text: "Reminder: All generated docs/images removed. Regenerate before next deploy." |