Publish GitHub Activity Digest #10
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: Publish GitHub Activity Digest | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '13 7 * * *' | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: github-activity-digest-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout activity-recognition | |
| uses: actions/checkout@v4 | |
| - name: Checkout github-activity-digest source | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: abensur/github-activity-digest | |
| path: tools/github-activity-digest | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Restore digest cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: tools/github-activity-digest/.cache | |
| key: github-activity-digest-${{ runner.os }}-${{ github.run_id }} | |
| restore-keys: | | |
| github-activity-digest-${{ runner.os }}- | |
| - name: Install digest dependencies | |
| working-directory: tools/github-activity-digest | |
| run: bun install --frozen-lockfile | |
| - name: Apply local digest config and custom prompt | |
| run: | | |
| cp digest/config.json tools/github-activity-digest/config.json | |
| cp digest/prompt-template-activity-recognition.txt tools/github-activity-digest/prompt-template-activity-recognition.txt | |
| - name: Run github-activity-digest | |
| shell: bash | |
| working-directory: tools/github-activity-digest | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| set -o pipefail | |
| bun run index.ts 2>&1 | tee "$RUNNER_TEMP/github-activity-digest.log" | |
| - name: Publish digest data | |
| run: | | |
| python3 scripts/publish_github_activity_digest.py \ | |
| --config-file "digest/config.json" \ | |
| --summary-file "tools/github-activity-digest/archive/weekly-report-$(date -u +%F).md" \ | |
| --log-file "$RUNNER_TEMP/github-activity-digest.log" \ | |
| --output-dir "docs/data" \ | |
| --source-repository "abensur/github-activity-digest" \ | |
| --source-config-path "digest/config.json" | |
| - name: Commit published data | |
| shell: bash | |
| run: | | |
| git add docs/data | |
| git diff --staged --quiet && { | |
| echo "No data changes to commit." | |
| exit 0 | |
| } | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit -m "Update GitHub activity digest data" | |
| git push |