Hourly Report Generator #6672
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: Hourly Report Generator | |
| on: | |
| schedule: | |
| # Run every hour at minute 0 | |
| - cron: '0 * * * *' | |
| # Allow manual trigger for testing | |
| workflow_dispatch: | |
| jobs: | |
| generate-report: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # Full git history for reports | |
| fetch-depth: 0 | |
| # Include submodules for artemis folder | |
| submodules: true | |
| # Use PAT instead of GITHUB_TOKEN | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Install dependencies | |
| run: npm ci --force | |
| - name: Setup Git identity | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Update artemis submodule | |
| run: | | |
| # Navigate into the artemis submodule directory | |
| cd artemis | |
| # Make sure we're on the main branch (or default branch) | |
| git checkout develop || git checkout main || git checkout master | |
| # Pull the latest changes | |
| git pull | |
| # Go back to the main repo directory | |
| cd .. | |
| - name: Run client-side report | |
| run: | | |
| # Force report to use the current state of artemis | |
| npm run report | |
| # Also generate the relative time report if needed | |
| npm run report -- --relative 2h | |
| - name: Run DTO violations report (static analysis) | |
| run: | | |
| # Full static analysis with JavaParser - no Artemis compilation needed! | |
| # This provides 93% accuracy with full details (files, lines, endpoints) | |
| npm run report:dto | |
| timeout-minutes: 5 | |
| - name: Commit changes | |
| run: | | |
| # Add artemis submodule changes | |
| git add artemis | |
| # Add any new report files | |
| git add data/ | |
| # Check if there are any changes | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| # Commit with current timestamp | |
| git commit -m "chore: update code stats report and artemis submodule for $(date +'%Y-%m-%d %H:%M')" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GH_PAT }} | |
| branch: ${{ github.ref_name }} |