Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Upgrade tend workflows from 0.0.3 to 0.0.5 (#1882)

Maximilian Roos79fc3165a928
diff --git a/.github/workflows/tend-ci-fix.yaml b/.github/workflows/tend-ci-fix.yaml
index 2cb3d09d4..50a6aec43 100644
--- a/.github/workflows/tend-ci-fix.yaml
+++ b/.github/workflows/tend-ci-fix.yaml
@@ -20,6 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
+ ref: main
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
diff --git a/.github/workflows/tend-mention.yaml b/.github/workflows/tend-mention.yaml
index 3a6eba23c..d10a3f49c 100644
--- a/.github/workflows/tend-mention.yaml
+++ b/.github/workflows/tend-mention.yaml
@@ -7,6 +7,8 @@ on:
issue_comment:
types: [created, edited]
# Works for same-repo PRs only; secrets unavailable on fork PRs (no _target variant exists)
+ pull_request_review:
+ types: [submitted]
pull_request_review_comment:
types: [created, edited]
@@ -19,10 +21,9 @@ jobs:
(github.event_name == 'issue_comment' &&
github.event.comment.user.login != 'worktrunk-bot') ||
(github.event_name == 'pull_request_review_comment' &&
- github.event.comment.user.login != 'worktrunk-bot')
- concurrency:
- group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number }}
- cancel-in-progress: true
+ github.event.comment.user.login != 'worktrunk-bot') ||
+ (github.event_name == 'pull_request_review' &&
+ github.event.review.user.login != 'worktrunk-bot')
runs-on: ubuntu-24.04
outputs:
should_run: ${{ steps.check.outputs.should_run }}
@@ -86,7 +87,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
EVENT_NAME: ${{ github.event_name }}
- COMMENT_BODY: ${{ github.event.comment.body }}
+ COMMENT_BODY: ${{ github.event.comment.body || github.event.review.body }}
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_OR_PR_NUMBER: ${{ github.event.issue.number }}
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
@@ -111,7 +112,7 @@ jobs:
if: needs.verify.outputs.should_run == 'true'
concurrency:
group: ${{ github.workflow }}-handle-${{ github.event.issue.number || github.event.pull_request.number }}
- cancel-in-progress: true
+ cancel-in-progress: false
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
@@ -130,7 +131,8 @@ jobs:
- name: Check out PR branch
if: |
(github.event_name == 'issue_comment' && github.event.issue.pull_request.url != '') ||
- github.event_name == 'pull_request_review_comment'
+ github.event_name == 'pull_request_review_comment' ||
+ github.event_name == 'pull_request_review'
run: |
PR_STATE=$(gh pr view "$PR_NUMBER" --json state --jq '.state')
if [ "$PR_STATE" = "OPEN" ]; then
@@ -144,18 +146,40 @@ jobs:
- uses: ./.github/actions/claude-setup
+ - name: Compute queue delay
+ id: delay
+ run: |
+ if [ -z "$EVENT_TS" ]; then
+ echo "seconds=" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ event_epoch=$(date -d "$EVENT_TS" +%s)
+ echo "seconds=$(( $(date +%s) - event_epoch ))" >> "$GITHUB_OUTPUT"
+ env:
+ EVENT_TS: ${{ github.event.comment.created_at || github.event.review.submitted_at || github.event.issue.updated_at }}
+
- uses: max-sixty/tend@v1
with:
github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
bot_name: worktrunk-bot
prompt: >-
+ ${{ steps.delay.outputs.seconds
+ && format('This job started {0}s after the triggering event (over ~40s means it was queued). ',
+ steps.delay.outputs.seconds) || '' }}Before acting,
+ check recent comments: exit silently if the bot already responded
+ to the trigger; handle any other unaddressed comments too.
+
${{ github.event_name == 'issues'
&& format('An issue was updated with a mention of you ({0}). Read it and respond.', github.event.issue.html_url)
|| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@worktrunk-bot')
&& format('You were mentioned in an inline review comment on PR #{0} ({1}, review comment ID {2}). Read the full PR context (description, diff, recent comments, CI status) and respond. If they are requesting changes, make the changes, commit, and push. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."` — do not create a new top-level comment.', (github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number), github.event.comment.html_url, github.event.comment.id, github.repository))
|| (github.event_name == 'pull_request_review_comment'
&& format('A user left an inline review comment on a PR where you previously participated (PR #{0}, {1}, review comment ID {2}). Read the full context. Only respond if the comment is directed at you or requests changes. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."`.', (github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number), github.event.comment.html_url, github.event.comment.id, github.repository))
+ || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@worktrunk-bot')
+ && format('A review was submitted on PR #{0} that mentions you ({1}). Read the review and full PR context (description, diff, comments, CI status), then respond. If changes were requested, make them, commit, and push.', github.event.pull_request.number, github.event.review.html_url))
+ || (github.event_name == 'pull_request_review'
+ && format('A review was submitted on a PR where you previously participated (PR #{0}, {1}). Read the review and full PR context. If the review requests changes or asks questions, respond appropriately. If the review approves or is between humans, exit silently.', github.event.pull_request.number, github.event.review.html_url))
|| (contains(github.event.comment.body, '@worktrunk-bot')
&& format('You were mentioned in a comment ({0}). Read the full issue or PR (description, diff, recent comments, CI status) and respond. If they are requesting changes, make the changes, commit, and push.', github.event.comment.html_url))
|| format('A user commented on an issue/PR where you previously participated ({0}). Read the full context. Only respond if the comment is directed at you, asks a question you can help with, or requests changes you can make. A comment that responds to concerns you raised in a review is directed at you — briefly acknowledge that the concerns are resolved (or explain why they are not). If the conversation is between humans, exit silently.', github.event.comment.html_url)
diff --git a/.github/workflows/tend-nightly.yaml b/.github/workflows/tend-nightly.yaml
index 6812b2ab6..f8cf403e2 100644
--- a/.github/workflows/tend-nightly.yaml
+++ b/.github/workflows/tend-nightly.yaml
@@ -19,6 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
+ ref: main
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
diff --git a/.github/workflows/tend-notifications.yaml b/.github/workflows/tend-notifications.yaml
new file mode 100644
index 000000000..79df38fdd
--- /dev/null
+++ b/.github/workflows/tend-notifications.yaml
@@ -0,0 +1,35 @@
+# Generated by tend. Regenerate with: uvx tend init
+
+name: tend-notifications
+on:
+ schedule:
+ - cron: "*/15 * * * *"
+ workflow_dispatch:
+
+jobs:
+ notifications:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 60
+ permissions:
+ contents: write
+ pull-requests: write
+ id-token: write
+ actions: read
+ issues: write
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ ref: main
+ fetch-depth: 0
+ fetch-tags: true
+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
+
+ - uses: ./.github/actions/claude-setup
+
+ - uses: max-sixty/tend@v1
+ with:
+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+ bot_name: worktrunk-bot
+ prompt: |
+ /tend-ci-runner:notifications
diff --git a/.github/workflows/tend-review-runs.yaml b/.github/workflows/tend-review-runs.yaml
new file mode 100644
index 000000000..bbba23a84
--- /dev/null
+++ b/.github/workflows/tend-review-runs.yaml
@@ -0,0 +1,35 @@
+# Generated by tend. Regenerate with: uvx tend init
+
+name: tend-review-runs
+on:
+ schedule:
+ - cron: "47 7 * * *"
+ workflow_dispatch:
+
+jobs:
+ review-runs:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 60
+ permissions:
+ contents: write
+ pull-requests: write
+ id-token: write
+ actions: read
+ issues: write
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ ref: main
+ fetch-depth: 0
+ fetch-tags: true
+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
+
+ - uses: ./.github/actions/claude-setup
+
+ - uses: max-sixty/tend@v1
+ with:
+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+ bot_name: worktrunk-bot
+ prompt: |
+ /tend-ci-runner:review-runs
diff --git a/.github/workflows/tend-review.yaml b/.github/workflows/tend-review.yaml
index cfd33a590..abc719a82 100644
--- a/.github/workflows/tend-review.yaml
+++ b/.github/workflows/tend-review.yaml
@@ -4,20 +4,13 @@ name: tend-review
on:
pull_request_target:
types: [opened, synchronize, ready_for_review, reopened]
- pull_request_review:
- types: [submitted]
jobs:
review:
- if: |
- (github.event_name == 'pull_request_target' &&
- github.event.pull_request.draft == false) ||
- (github.event_name == 'pull_request_review' &&
- github.event.pull_request.user.login == 'worktrunk-bot' &&
- github.event.review.user.login != 'worktrunk-bot' &&
- (github.event.review.state != 'approved' || github.event.review.body))
+ if: >-
+ github.event.pull_request.draft == false
concurrency:
- group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }}
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-24.04
timeout-minutes: 60
@@ -28,30 +21,13 @@ jobs:
actions: read
issues: write
steps:
- - name: Checkout (initial review)
- if: github.event_name == 'pull_request_target'
- uses: actions/checkout@v6
+ - uses: actions/checkout@v6
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
- - name: Checkout (review response)
- if: github.event_name == 'pull_request_review'
- uses: actions/checkout@v6
- with:
- fetch-depth: 0
- fetch-tags: true
- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
-
- - name: Check out PR branch (review response)
- if: github.event_name == 'pull_request_review'
- run: gh pr checkout "$PR_NUMBER"
- env:
- GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
-
- uses: ./.github/actions/claude-setup
- uses: max-sixty/tend@v1
@@ -59,12 +35,6 @@ jobs:
github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
bot_name: worktrunk-bot
- use_sticky_comment: ${{ github.event_name == 'pull_request_target' }}
+ use_sticky_comment: true
prompt: >-
- ${{ github.event_name == 'pull_request_target'
- && format('/tend-ci-runner:review {0}', github.event.pull_request.number)
- || format(
- 'A review was submitted on your PR #{0} ({1}). Read the review and full PR context (description, diff, comments, CI status), then respond appropriately. If changes were requested, make them, commit, and push. If questions were asked, answer them.',
- github.event.pull_request.number,
- github.event.review.html_url
- ) }}
+ ${{ format('/tend-ci-runner:review {0}', github.event.pull_request.number) }}
diff --git a/.github/workflows/tend-triage.yaml b/.github/workflows/tend-triage.yaml
index 50e7712be..2eb6be2af 100644
--- a/.github/workflows/tend-triage.yaml
+++ b/.github/workflows/tend-triage.yaml
@@ -12,7 +12,6 @@ concurrency:
jobs:
triage:
if: >-
- github.event.issue.user.type != 'Bot' &&
github.event.issue.user.login != 'worktrunk-bot'
runs-on: ubuntu-24.04
timeout-minutes: 60
@@ -25,6 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
+ ref: main
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
diff --git a/.github/workflows/tend-renovate.yaml b/.github/workflows/tend-weekly.yaml
similarity index 89%
rename from .github/workflows/tend-renovate.yaml
rename to .github/workflows/tend-weekly.yaml
index 78529403c..1dd60b106 100644
--- a/.github/workflows/tend-renovate.yaml
+++ b/.github/workflows/tend-weekly.yaml
@@ -1,13 +1,13 @@
# Generated by tend. Regenerate with: uvx tend init
-name: tend-renovate
+name: tend-weekly
on:
schedule:
- cron: "17 9 * * 0"
workflow_dispatch:
jobs:
- renovate:
+ weekly:
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
@@ -19,6 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
+ ref: main
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}
@@ -31,4 +32,4 @@ jobs:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
bot_name: worktrunk-bot
prompt: |
- /tend-ci-runner:renovate
+ /tend-ci-runner:weekly