Add abdellatif-temsamani/adev.nvim
#707
Workflow file for this run
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: PR Quality Analysis | |
| permissions: read-all | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| schedule: | |
| # Run weekly to check repository health | |
| - cron: '0 6 * * 1' # Monday at 6 AM UTC | |
| workflow_dispatch: {} | |
| jobs: | |
| quality-analysis: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| env: | |
| ANALYSIS_TYPE: 'all_open' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Check if PR is from fork | |
| if: github.event_name == 'pull_request' | |
| id: fork-check | |
| run: | | |
| if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then | |
| echo "is_fork=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_fork=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Determine PRs to analyze | |
| id: get-prs | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| echo "pr_numbers=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
| else | |
| # Scheduled run - get all open PRs | |
| PR_LIST=$(gh pr list --state open --limit 20 --json number --jq '.[].number' | tr '\n' ',' | sed 's/,$//') | |
| echo "pr_numbers=$PR_LIST" >> $GITHUB_OUTPUT | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| # Always run all_open for workflow_dispatch | |
| echo -e "\nGetting all open PRs..." | |
| fi | |
| fi | |
| - name: Run repository quality analysis | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| echo -e "## π Repository Quality Analysis:\n" > quality_report.md | |
| PR_NUMBERS="${{ steps.get-prs.outputs.pr_numbers }}" | |
| if [ -n "$PR_NUMBERS" ]; then | |
| echo -e "Analyzing PRs: $PR_NUMBERS\n" | |
| # Convert comma-separated to space-separated | |
| PR_LIST=$(echo "$PR_NUMBERS" | tr ',' ' ') | |
| # Run quality analysis | |
| ./scripts/batch_pr_readme_review.sh $PR_LIST > quality_output.txt 2>&1 | |
| # Parse results for report | |
| echo -e "### Analysis Results:\n" >> quality_report.md | |
| # Extract priority PRs | |
| if grep -q "π¨ PRIORITY:" quality_output.txt; then | |
| echo -e "#### π¨ Priority PRs (Updated After Review):\n" >> quality_report.md | |
| grep -A 10 "π¨ PRIORITY:" quality_output.txt | grep "=== Priority README Review for PR" | sed 's/=== Priority README Review for PR /- PR /' >> quality_report.md | |
| echo "" >> quality_report.md | |
| fi | |
| # Extract PRs needing review | |
| if grep -q "π Processing PRs needing initial review" quality_output.txt; then | |
| echo -e "#### π PRs Needing Initial Review:\n" >> quality_report.md | |
| grep -A 10 "π Processing PRs needing initial review" quality_output.txt | grep "=== README Review for PR" | sed 's/=== README Review for PR /- PR /' >> quality_report.md | |
| echo "" >> quality_report.md | |
| fi | |
| # Extract summary | |
| if grep -q "=== README REVIEW SUMMARY ===" quality_output.txt; then | |
| echo -e "#### Summary:\n" >> quality_report.md | |
| grep -A 5 "=== README REVIEW SUMMARY ===" quality_output.txt | tail -n +2 >> quality_report.md | |
| echo "" >> quality_report.md | |
| fi | |
| # Add repository health warnings | |
| if grep -q "β οΈ WARNING" quality_output.txt; then | |
| echo -e "#### β οΈ Repository Health Warnings:\n" >> quality_report.md | |
| grep "β οΈ WARNING" quality_output.txt | sed 's/β οΈ WARNING: /- /' >> quality_report.md | |
| echo "" >> quality_report.md | |
| fi | |
| # Add license information | |
| if grep -q "β License found" quality_output.txt; then | |
| echo -e "#### β License Status:\n" >> quality_report.md | |
| grep -A 2 "β License found" quality_output.txt | head -3 >> quality_report.md | |
| echo "" >> quality_report.md | |
| fi | |
| else | |
| echo -e "**No PRs to analyze at this time.**\n" >> quality_report.md | |
| fi | |
| echo -e "---\n_Quality analysis powered by [enhanced repository review scripts](scripts/)._" >> quality_report.md | |
| # Save output for artifacts | |
| cp quality_output.txt quality_analysis_raw.txt 2> /dev/null || true | |
| - name: Post quality analysis for single PR (non-fork only) | |
| if: github.event_name == 'pull_request' && steps.fork-check.outputs.is_fork == 'false' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('quality_report.md', 'utf8'); | |
| try { | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existingComment = comments.find(comment => | |
| comment.body.includes('π Repository Quality Analysis') && | |
| (comment.user.type === 'Bot' || comment.user.login === 'github-actions[bot]') | |
| ); | |
| if (existingComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existingComment.id, | |
| body: report | |
| }); | |
| console.log('β Updated quality analysis comment'); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: report | |
| }); | |
| console.log('β Posted quality analysis comment'); | |
| } | |
| } catch (error) { | |
| console.error(`β Failed to post quality analysis: ${error.message}`); | |
| core.setFailed(`Failed to post comment: ${error.message}`); | |
| } | |
| - name: Output quality analysis for fork PRs | |
| if: github.event_name == 'pull_request' && steps.fork-check.outputs.is_fork == 'true' | |
| run: | | |
| echo -e "Fork PR detected - quality analysis saved as workflow output.\n" | |
| cat quality_report.md | |
| echo -e "\nβ οΈ Maintainers: Review the quality analysis above for this fork PR." | |
| - name: Create issue for scheduled analysis | |
| if: github.event_name == 'schedule' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('quality_report.md', 'utf8'); | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: `Weekly Repository Quality Report - ${new Date().toISOString().split('T')[0]}`, | |
| body: `${report}\n\n*This is an automated weekly quality analysis.*`, | |
| labels: ['maintenance', 'automated-report'] | |
| }); | |
| - name: Upload analysis artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: quality-analysis-${{ github.run_number }} | |
| path: | | |
| quality_report.md | |
| quality_analysis_raw.txt | |
| retention-days: 30 |