This repository was archived by the owner on Sep 10, 2025. It is now read-only.
📁 Generate Error Documentation from Issues #1972
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: 📁 Generate Error Documentation from Issues | |
| on: | |
| workflow_run: | |
| workflows: ["Auto Create Issues Every 10 Minutes"] | |
| types: | |
| - completed | |
| permissions: | |
| contents: write | |
| issues: read | |
| jobs: | |
| generate-doc: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Download latest issue content | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh issue list --limit 1 --state open --json number,title,body > latest-issue.json | |
| jq -r '.[0].title' latest-issue.json > title.txt | |
| jq -r '.[0].body' latest-issue.json > body.txt | |
| - name: Detect topic from title and body | |
| id: topic | |
| run: | | |
| CONTENT=$(cat title.txt body.txt | tr '[:upper:]' '[:lower:]') | |
| if echo "$CONTENT" | grep -q "nextjs"; then | |
| echo "topic=nextjs" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "tailwind"; then | |
| echo "topic=tailwinds" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "mern"; then | |
| echo "topic=mern" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "react"; then | |
| echo "topic=react" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "express"; then | |
| echo "topic=expressjs" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "openai"; then | |
| echo "topic=openai" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "vue"; then | |
| echo "topic=vuejs" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "jquery"; then | |
| echo "topic=jquery" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "javascript"; then | |
| echo "topic=javascript" >> $GITHUB_OUTPUT | |
| elif echo "$CONTENT" | grep -q "css"; then | |
| echo "topic=css" >> $GITHUB_OUTPUT | |
| else | |
| echo "topic=general" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Sanitize folder name from issue title | |
| id: folder | |
| run: | | |
| FOLDER=$(cat title.txt | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//') | |
| echo "folder=$FOLDER" >> $GITHUB_OUTPUT | |
| - name: Create README.md from issue | |
| run: | | |
| mkdir -p "errors/${{ steps.topic.outputs.topic }}/${{ steps.folder.outputs.folder }}" | |
| echo "# 🐞 $(cat title.txt)" > "errors/${{ steps.topic.outputs.topic }}/${{ steps.folder.outputs.folder }}/README.md" | |
| echo "" >> "errors/${{ steps.topic.outputs.topic }}/${{ steps.folder.outputs.folder }}/README.md" | |
| cat body.txt >> "errors/${{ steps.topic.outputs.topic }}/${{ steps.folder.outputs.folder }}/README.md" | |
| - name: Set up Git identity as real user | |
| run: | | |
| git config user.name "openrocketsofficial" | |
| git config user.email "[email protected]" | |
| - name: Commit and push with PAT | |
| env: | |
| TOKEN: ${{ secrets.OPENROCKETS_PAT }} | |
| run: | | |
| git add . | |
| git commit -m "updated" || echo "Nothing to commit" | |
| git remote set-url origin https://openrocketsofficial:${TOKEN}@github.com/${{ github.repository }} | |
| git push origin HEAD |