Skip to content

Rebase Status Wiki #781

Rebase Status Wiki

Rebase Status Wiki #781

name: Rebase Status Wiki
on:
workflow_run:
workflows: ["Auto Rebase"]
types: [completed]
schedule:
- cron: '0 * * * 1-5'
workflow_dispatch:
inputs:
notify_branches:
description: 'Branches to send Slack notifications for (comma-separated, or empty to skip)'
required: false
default: ''
env:
BRANCHES: oadp-dev oadp-1.6 oadp-1.5 oadp-1.4 oadp-1.3
NOTIFY_BRANCHES: oadp-1.6
permissions:
contents: write
pages: write
id-token: write
jobs:
update-wiki-and-pages:
runs-on: ubuntu-latest
concurrency:
group: pages
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: tools/rebase-status/go.sum
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: tools/rebase-dashboard/package-lock.json
- name: Build rebase-status
run: make -C tools/rebase-status rebase-status
- name: Generate status reports and DAG data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p /tmp/dag-data
branches=""
for branch in $BRANCHES; do
echo "::group::rebase-status $branch"
# Markdown for wiki
tools/rebase-status/rebase-status \
--config-dir rebase-configs \
--format markdown \
"$branch" > "/tmp/Rebase-Status-${branch}.md" || \
echo "::warning::rebase-status exited non-zero for ${branch} (check errors in output)"
if [ ! -s "/tmp/Rebase-Status-${branch}.md" ]; then
echo "::error::rebase-status produced no output for ${branch}"
exit 1
fi
# JSON for DAG/dashboard (runs fast — GitHub API responses are cached from the markdown run)
raw_json=$(tools/rebase-status/rebase-status \
--config-dir rebase-configs \
--json \
"$branch" 2>/dev/null) || \
echo "::notice::rebase-status exited non-zero for $branch (issues found)"
echo "$raw_json" | jq 'if type == "object" then {repos: .repos, cve_prs: (.cve_prs // [])} else {repos: ., cve_prs: []} end' > "/tmp/dag-data/${branch}.json" || echo '{"repos":[],"cve_prs":[]}' > "/tmp/dag-data/${branch}.json"
echo "::endgroup::"
branches="${branches:+$branches,}\"$branch\""
done
default_branch=$(echo "$BRANCHES" | awk '{print $1}')
cat > /tmp/dag-data/metadata.json <<EOF
{"branches": [$branches], "generated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", "default_branch": "$default_branch"}
EOF
- name: Clone wiki repo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wiki_url="https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.wiki.git"
git clone "$wiki_url" /tmp/wiki
- name: Generate Home page
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tools/rebase-status/rebase-status \
--config-dir rebase-configs \
--format home \
--tally-file /tmp/wiki/pr-tallies.json \
--rebase-log /tmp/wiki/Auto-Rebase-V2-Log.md \
$BRANCHES \
> /tmp/Home.md
- name: Push to wiki
run: |
for branch in $BRANCHES; do
cp "/tmp/Rebase-Status-${branch}.md" "/tmp/wiki/Rebase-Status-${branch}.md"
done
cp /tmp/Home.md /tmp/wiki/Home.md
cd /tmp/wiki
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "No changes to wiki"
else
git commit -m "Update rebase status $(date -u +%Y-%m-%d)"
git push
fi
- name: Build Rebase Dashboard
run: |
cd tools/rebase-dashboard
npm ci
npm run build
- name: Assemble pages
run: bash tools/assemble-pages.sh
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v4
with:
path: _site
- id: deployment
uses: actions/deploy-pages@v5
notify-slack:
if: >-
(github.event_name == 'workflow_run' && github.event.workflow_run.event == 'schedule') ||
(github.event_name == 'workflow_dispatch' && inputs.notify_branches != '')
needs: update-wiki-and-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: tools/rebase-status/go.sum
- name: Build rebase-status
run: make -C tools/rebase-status rebase-status
- name: Generate Slack payload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTIFY_BRANCHES: ${{ github.event_name != 'workflow_dispatch' && env.NOTIFY_BRANCHES || inputs.notify_branches }}
run: |
[ -z "$NOTIFY_BRANCHES" ] && { echo "No branches to notify"; exit 0; }
all_json="[]"
for branch in $(echo "$NOTIFY_BRANCHES" | tr ',' ' '); do
branch_json=$(tools/rebase-status/rebase-status \
--config-dir rebase-configs \
--json \
--hide-dependency-details \
"$branch" 2>/dev/null) || true
# Extract .repos array from object format, fall back to raw array
branch_repos=$(echo "$branch_json" | jq 'if type == "object" then .repos else . end')
all_json=$(echo "$all_json" "$branch_repos" | jq -s 'add')
done
echo "$all_json" | bash tools/auto-rebase/rebase-status-notify.sh \
--gh-token "$GITHUB_TOKEN" \
> /tmp/slack-status-payload.json
if jq -e '.empty // false' /tmp/slack-status-payload.json >/dev/null 2>&1; then
echo "No actionable items — skipping Slack notification"
echo "SKIP_NOTIFY=true" >> "$GITHUB_ENV"
else
echo "Slack payload:"
jq . /tmp/slack-status-payload.json
fi
- name: Send Slack notification
if: env.SKIP_NOTIFY != 'true'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
if [ -z "$SLACK_WEBHOOK_URL" ]; then
echo "SLACK_WEBHOOK_URL not set — skipping"
exit 0
fi
curl -sfS -X POST -H 'Content-type: application/json' \
-d @/tmp/slack-status-payload.json "$SLACK_WEBHOOK_URL"