Infrastructure: Update Armbian automation status #2464
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: "Infrastructure: Update Armbian automation status" | |
| on: | |
| schedule: | |
| - cron: '*/30 * * * *' | |
| workflow_dispatch: | |
| inputs: | |
| scan_root: | |
| description: "Folder to scan (default .github)" | |
| required: false | |
| default: ".github" | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| jobs: | |
| scan-repositories: | |
| name: "Scan" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| models: read | |
| strategy: | |
| matrix: | |
| repo: ["armbian.github.io", "build", "imager", "os", "sdk", "documentation", "shallow", "docker-armbian-build", "configng"] | |
| fail-fast: false | |
| max-parallel: 1 # free api is very limited | |
| steps: | |
| - name: Checkout ${{ matrix.repo }} | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: armbian/${{ matrix.repo }} | |
| path: repo-source | |
| fetch-depth: 0 | |
| - name: Checkout script repo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: armbian/armbian.github.io | |
| path: script-repo | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| - name: Install deps | |
| run: | | |
| npm init -y | |
| npm i fast-glob js-yaml | |
| - name: Restore AI description cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: repo-source/.ai-cache | |
| key: ai-descriptions-${{ matrix.repo }}-${{ hashFiles('repo-source/.github/**/*.yml', 'repo-source/.github/**/*.yaml') }} | |
| restore-keys: | | |
| ai-descriptions-${{ matrix.repo }}- | |
| ai-descriptions- | |
| - name: Generate report for ${{ matrix.repo }} | |
| run: | | |
| cd repo-source | |
| GITHUB_REPOSITORY=armbian/${{ matrix.repo }} SCAN_ROOT=${{ inputs.scan_root }} node ../script-repo/scripts/generate-actions-report.mjs | |
| mv actions-report.json ../actions-report-${{ matrix.repo }}.json | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| AI_PROVIDER: openai | |
| AI_MODEL: gpt-4o-mini | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: actions-report-${{ matrix.repo }} | |
| path: actions-report-${{ matrix.repo }}.json | |
| merge-and-commit: | |
| needs: scan-repositories | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout data branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: data | |
| path: data-branch | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts | |
| - name: Merge reports | |
| run: | | |
| mkdir -p data-branch/data/actions-report | |
| cp artifacts/actions-report-*/*.json data-branch/data/actions-report/ 2>/dev/null || true | |
| ls -la data-branch/data/actions-report/ | |
| - name: Generate index | |
| run: | | |
| cd data-branch/data/actions-report | |
| # Create list of all JSON files | |
| files=$(ls actions-report-*.json 2>/dev/null | sort) | |
| # Generate index.json | |
| echo "{\"generated\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"files\":[" > index.json | |
| first=true | |
| for f in $files; do | |
| if [ "$first" = true ]; then | |
| first=false | |
| else | |
| echo "," >> index.json | |
| fi | |
| echo -n "\"$f\"" >> index.json | |
| done | |
| echo "]}" >> index.json | |
| cat index.json | |
| - name: Commit to data branch | |
| run: | | |
| set -euo pipefail | |
| cd data-branch | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git fetch origin data | |
| git checkout data | |
| git add data/actions-report/ | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Update actions reports [skip ci]" | |
| # Push with retry logic | |
| max_attempts=3 | |
| attempt=1 | |
| while [ $attempt -le $max_attempts ]; do | |
| if git push origin data; then | |
| echo "Successfully pushed to data branch" | |
| exit 0 | |
| fi | |
| # Pull with rebase to resolve conflicts | |
| echo "Push failed, attempting to pull and rebase..." >&2 | |
| if ! git pull --rebase origin data; then | |
| echo "Pull/rebase failed, will retry push..." >&2 | |
| fi | |
| attempt=$((attempt + 1)) | |
| done | |
| echo "Failed to push after $max_attempts attempts" >&2 | |
| exit 1 | |
| fi | |
| # Run website generation | |
| - name: "Generate website actions.armbian.com" | |
| uses: peter-evans/repository-dispatch@v4 | |
| with: | |
| token: ${{ secrets.DISPATCH }} | |
| repository: armbian/actions | |
| event-type: "Generate website" |