Skip to content

Autopilot Docs Daily #34

Autopilot Docs Daily

Autopilot Docs Daily #34

name: Autopilot Docs Daily
on:
schedule:
# 18:05 Europe/Helsinki (UTC+2/UTC+3). Cron is UTC.
- cron: "5 15 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: read
jobs:
docs:
runs-on: ubuntu-latest
env:
ORG: ${{ vars.ORG || github.repository_owner }}
GH_TOKEN: ${{ secrets.ORG_READ_TOKEN || github.token }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Update status docs
run: |
set -euo pipefail
if [ -z "${ORG}" ]; then
echo "ORG env var is required."
exit 1
fi
ts=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
repos=$(gh api orgs/${ORG}/repos --paginate --jq '.[].name')
table="| Repo | Autofix queued | In-progress | Blocked | Done |\n| ---- | -------------- | ----------- | ------- | ---- |"
for repo in $repos; do
q_base="repo:${ORG}/${repo} is:issue is:open label:autofix"
queued=$(gh api search/issues -f q="${q_base} label:queued" --jq .total_count)
inprogress=$(gh api search/issues -f q="${q_base} label:in-progress" --jq .total_count)
blocked=$(gh api search/issues -f q="${q_base} label:blocked" --jq .total_count)
done=$(gh api search/issues -f q="${q_base} label:done" --jq .total_count)
table="${table}\n| ${ORG}/${repo} | ${queued} | ${inprogress} | ${blocked} | ${done} |"
done
printf '# Autopilot Status\n\nLast updated: %s\n\n## Repository coverage\n\n%b\n' "${ts}" "${table}" > docs/status.md
- name: Create PR
run: |
set -euo pipefail
if git diff --quiet; then
echo "No changes to commit."
exit 0
fi
branch="docs/daily-status"
git checkout -B "${branch}"
git add docs/status.md
git commit -m "Update autopilot status"
git push -f origin "${branch}"
gh pr create -t "Daily autopilot status update" -b "Automated docs update." --base main --head "${branch}" || true