Problem: the initial approach created GitHub issues for new upstream activity, which accumulate and require a separate triage step outside the codebase. Solution: rewrite the script to append new rows directly to doc/upstream.md (open PRs and issues to their respective tables, merged PRs with "merged — not cherry-picked" status), then open a PR with auto-merge enabled. The workflow formats the markdown with prettier before committing so the markdown-format check passes.
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: upstream digest
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 9 * * 1"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
digest:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Update upstream tracker
|
|
id: digest
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: python3 .github/scripts/upstream_digest.py
|
|
|
|
- name: Format doc/upstream.md
|
|
if: steps.digest.outputs.changed == 'true'
|
|
run: npx --yes prettier --write doc/upstream.md
|
|
|
|
- name: Create PR
|
|
if: steps.digest.outputs.changed == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
DATE=$(date +%Y-%m-%d)
|
|
BRANCH="ci/upstream-digest-${DATE}"
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git checkout -b "${BRANCH}"
|
|
git add doc/upstream.md
|
|
git commit -m "docs(upstream): add digest for week of ${DATE}"
|
|
git push origin "${BRANCH}"
|
|
PR_URL=$(gh pr create \
|
|
--title "docs(upstream): add digest for week of ${DATE}" \
|
|
--body "Automated weekly digest of new upstream activity. Triage by updating statuses and notes." \
|
|
--base main \
|
|
--head "${BRANCH}")
|
|
gh pr merge "${PR_URL}" --auto --squash
|