Skip to content

PR Report

PR Report #299

Workflow file for this run

name: PR Report
on:
workflow_dispatch:
push:
paths-ignore:
- README.md
- AGENTS.md
- .github/wiki/**
- template/README.md
- template/AGENTS.md
schedule:
- cron: '0 2 * * 1-5' # weekdays at 9 AM ICT (UTC+7)
permissions:
contents: read
pull-requests: read
actions: read
jobs:
report:
name: Post PR Report to Slack
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # actions/checkout@v6.0.2
with:
fetch-depth: 1
- name: Find previous successful run
id: prev_run
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
run_id=""
for candidate in $(gh api \
"repos/${{ github.repository }}/actions/workflows/pr_report.yml/runs?status=success&per_page=20" \
--jq '.workflow_runs[] | select(.id != ${{ github.run_id }}) | .id'); do
has_artifact=$(gh api \
"repos/${{ github.repository }}/actions/runs/${candidate}/artifacts" \
--jq 'any(.artifacts[]?; .name == "pr-report-ts")')
if [ "$has_artifact" = "true" ]; then
run_id="$candidate"
break
fi
done
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
- name: Download daily TS artifact
if: steps.prev_run.outputs.run_id != ''
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # actions/download-artifact@v8.0.1
with:
name: pr-report-ts
run-id: ${{ steps.prev_run.outputs.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run PR Report
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
GITHUB_REPOSITORY: ${{ github.repository }}
SLACK_BOT_TOKEN: ${{ secrets.PR_REPORT_SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.PR_REPORT_SLACK_CHANNEL_ID }}
PR_REPORT_TS_FILE: .pr_report_ts
run: |
if [ -z "$SLACK_BOT_TOKEN" ]; then
echo "Slack secrets not configured, skipping report"
exit 0
fi
python3 scripts/pr_report.py
- name: Upload daily TS artifact
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # actions/upload-artifact@v7.0.1
with:
name: pr-report-ts
path: .pr_report_ts
retention-days: 1
overwrite: true
include-hidden-files: true
if-no-files-found: ignore