Files
max-sixty__worktrunk/.github/scripts/list-recent-runs.sh
Maximilian Roos 4817604b81 Replace hand-written Claude workflows with generated ones (tend) (#1676)
## Summary

- Replaces 7 hand-written Claude CI workflow files with 6 generated by
`uvx tend init` from `.config/tend.toml`
- Consolidates 5 project-specific skills (`review-pr`, `triage-issue`,
`fix-ci`, `nightly-cleaner`, `running-in-ci`) into a single
`running-tend` overlay skill that extends the generic skills now in the
`tend` repo
- Moves `review-reviewers` skill to the `tend` repo (it's not
project-specific)
- Adds `.github/actions/claude-setup` composite action for project setup
steps
- Adds `.github/tend-security-model.md` documenting worktrunk-specific
security configuration
- Deletes `claude-hourly-review-reviewers.yaml` (moved to tend repo)

The generated workflows are produced by the
[tend](https://github.com/max-sixty/tend) generator, which handles
triggers, conditions, engagement verification, checkout, and the
composite action invocation. Project-specific config (bot name, secrets,
setup steps, watched workflows, cron schedules) lives in
`.config/tend.toml`.

Net: -1585 lines. The deleted code is now in the `tend` repo as reusable
infrastructure.

> _This was written by Claude Code on behalf of @max-sixty_

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-23 21:15:53 -07:00

41 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Lists recently completed Claude CI runs.
#
# Fetches runs started in the past 3 hours, then filters to only those that
# are completed and whose updatedAt is within the past hour. This two-step
# approach is needed because `gh run list --created` filters by *start* time,
# not *end* time — a run started 2h ago may have just finished, and a run
# started 50min ago may still be running. See #1301 for details.
#
# Output: JSON array of {databaseId, conclusion, createdAt, updatedAt} objects.
set -euo pipefail
# Prevent gh from emitting ANSI color codes in non-TTY contexts.
export NO_COLOR=1
# Dynamically discover all tend-* workflows instead of maintaining a hardcoded list.
mapfile -t WORKFLOWS < <(gh workflow list --json name --jq '.[].name | select(startswith("tend-"))')
CREATED_SINCE=$(date -d '3 hours ago' +%Y-%m-%dT%H:%M:%S)
COMPLETED_AFTER=$(date -d '1 hour ago' +%s)
all_runs="[]"
for wf in "${WORKFLOWS[@]}"; do
runs=$(gh run list \
--workflow "${wf}" \
--created ">=${CREATED_SINCE}" \
--json databaseId,conclusion,createdAt,updatedAt \
--limit 50 2>/dev/null || echo "[]")
all_runs=$(echo "$all_runs" "$runs" | jq -s 'add')
done
# Filter: drop in-progress (empty conclusion), keep only recently finished
echo "$all_runs" | jq --argjson cutoff "$COMPLETED_AFTER" '
[ .[]
| select(.conclusion != null and .conclusion != "")
| select((.updatedAt | fromdateiso8601) >= $cutoff)
]
'