Update README with GitHub Actions information #2
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: π¨ Coding Standards Check | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| push: | |
| branches: [main, master] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| jobs: | |
| coding-standards: | |
| name: π Style & Standards | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: π Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3.5' | |
| bundler-cache: true | |
| - name: π¨ RuboCop Analysis | |
| uses: reviewdog/action-rubocop@v2 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| rubocop_version: gemfile | |
| rubocop_extensions: rubocop-rspec:gemfile rubocop-performance:gemfile rubocop-factory_bot:gemfile | |
| reporter: github-pr-review | |
| fail_on_error: false | |
| filter_mode: added | |
| rubocop_flags: '--display-cop-names --format github' | |
| - name: π Generate Standards Report | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| echo "## π¨ Coding Standards Analysis" > standards-report.md | |
| echo "" >> standards-report.md | |
| # Run RuboCop and capture results | |
| if bundle exec rubocop --format json --out rubocop-results.json; then | |
| echo "β **All coding standards checks passed!**" >> standards-report.md | |
| echo "" >> standards-report.md | |
| echo "No RuboCop offenses found in this PR." >> standards-report.md | |
| else | |
| # Parse JSON results for summary | |
| total_files=$(jq '.summary.target_file_count' rubocop-results.json 2>/dev/null || echo "unknown") | |
| offense_count=$(jq '.summary.offense_count' rubocop-results.json 2>/dev/null || echo "unknown") | |
| echo "β οΈ **Found $offense_count coding standard violations across $total_files files**" >> standards-report.md | |
| echo "" >> standards-report.md | |
| echo "### Most Common Issues:" >> standards-report.md | |
| # Get top cop violations | |
| jq -r '.files[].offenses[].cop_name' rubocop-results.json 2>/dev/null | sort | uniq -c | sort -nr | head -5 | while read count cop; do | |
| echo "- **$cop**: $count occurrences" >> standards-report.md | |
| done | |
| echo "" >> standards-report.md | |
| echo "π‘ **Quick Fix Tips:**" >> standards-report.md | |
| echo "- Run \`bundle exec rubocop --auto-correct\` to fix auto-correctable issues" >> standards-report.md | |
| echo "- Check individual file comments above for specific violations" >> standards-report.md | |
| fi | |
| echo "" >> standards-report.md | |
| echo "---" >> standards-report.md | |
| echo "_Standards enforced by [RuboCop](https://rubocop.org/) β’ View [our style guide](.rubocop.yml)_" >> standards-report.md | |
| - name: π¬ Update PR Comment | |
| if: github.event_name == 'pull_request' | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body-path: standards-report.md | |
| edit-mode: replace | |
| comment-author: 'github-actions[bot]' | |
| body-includes: 'π¨ Coding Standards Analysis' |