Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- minor
- major
pre_release:
description: "Pre-release (skips Slack notification)"
description: "Create a beta tag only (e.g. v1.4.5-beta.1). No GitHub Release, no Docker Hub push, no self-ref PR."
required: false
default: false
type: boolean
Expand All @@ -33,6 +33,7 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
sha: ${{ steps.release-commit.outputs.sha }}
pre_release: ${{ steps.version.outputs.pre_release }}

steps:
- name: Checkout for composite actions
Expand Down Expand Up @@ -64,9 +65,11 @@ jobs:
id: version
env:
BUMP_TYPE: ${{ inputs.version_bump }}
PRE_RELEASE: ${{ inputs.pre_release }}
run: |
# Get the latest semver tag
LATEST_TAG=$(git tag -l 'v*.*.*' --sort=-v:refname | head -n1)
# Get the latest release tag — exclude pre-release tags (e.g. -beta.*) so they
# don't interfere with base version detection.
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n1)

if [ -z "$LATEST_TAG" ]; then
echo "No existing version tags found, starting at v0.0.0"
Expand All @@ -88,15 +91,32 @@ jobs:

NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"

# Collision avoidance: if tag already exists, bump patch until unique
# Collision avoidance on the base semver (run before appending beta suffix).
while git rev-parse "$NEW_VERSION" >/dev/null 2>&1; do
echo "Tag $NEW_VERSION already exists, bumping patch..."
PATCH=$((PATCH + 1))
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
done

if [ "$PRE_RELEASE" = "true" ]; then
# Find the highest existing beta number for this base version and increment.
# Strip prefix first and sort numerically to avoid git versionsort ambiguity
# with double-digit suffixes (e.g. -beta.10 vs -beta.9).
BETA_NUM=$(git tag -l "${NEW_VERSION}-beta.*" \
| sed 's/.*-beta\.//' \
| sort -rn \
| head -n1)
if [ -n "$BETA_NUM" ]; then
BETA_NUM=$((BETA_NUM + 1))
else
BETA_NUM=1
fi
NEW_VERSION="${NEW_VERSION}-beta.${BETA_NUM}"
fi

echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "previous=${LATEST_TAG}" >> $GITHUB_OUTPUT
echo "pre_release=${PRE_RELEASE}" >> $GITHUB_OUTPUT
echo "New version: $NEW_VERSION (previous: ${LATEST_TAG:-none})"

# CI cannot push commits to main (branch protection). Instead, we create
Expand Down Expand Up @@ -208,6 +228,7 @@ jobs:
echo "✅ Tag ${VERSION} created pointing to ${RELEASE_SHA}"

- name: Create GitHub Release
if: ${{ !inputs.pre_release }}
env:
VERSION: ${{ steps.version.outputs.version }}
PREVIOUS: ${{ steps.version.outputs.previous }}
Expand All @@ -222,6 +243,7 @@ jobs:
publish-agent:
name: Push review-pr agent to Docker Hub
needs: release
if: success() && !inputs.pre_release
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -288,7 +310,7 @@ jobs:
update-self-refs:
name: Update self-refs in cagent-action main
needs: release
if: success()
if: success() && !inputs.pre_release
runs-on: ubuntu-latest
concurrency:
group: update-self-refs
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/self-review-pr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Self PR Review
on:
workflow_dispatch:
inputs:
pr-number:
description: "PR number to review (e2e test — runs review-pr.yml from this branch)"
required: true
type: string
issue_comment:
types: [ created ]
workflow_run:
Expand Down Expand Up @@ -40,6 +46,7 @@ jobs:
review:
name: Review
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'issue_comment' ||
github.event.workflow_run.conclusion == 'success'
uses: ./.github/workflows/review-pr.yml
Expand All @@ -51,5 +58,6 @@ jobs:
id-token: write # Required for OIDC authentication to AWS Secrets Manager
actions: read # Download artifacts from trigger workflow
with:
pr-number: ${{ inputs.pr-number || '' }}
trigger-run-id: ${{ github.event_name == 'workflow_run' && format('{0}',
github.event.workflow_run.id) || '' }}
9 changes: 3 additions & 6 deletions review-pr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -845,13 +845,10 @@ runs:
echo "review-url=$REVIEW_URL" >> $GITHUB_OUTPUT

if [ "$SKIP_REASON" = "concurrent" ]; then
# Stay silent — the 👀 reaction on the triggering comment (added by the
# run that won the lock) is sufficient feedback that a review is running.
# Posting a comment here creates noise and can trigger a comment loop.
STATUS="⏭️ **Review skipped** — another review is already in progress"
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
-f body="⏭️ **Review skipped** — another review for this PR is already in progress (started ${LOCK_AGE}s ago). Only one review runs at a time to avoid duplicate comments. The in-progress review will post its results when complete." \
2>&1 || {
echo "::warning::Failed to post skip comment to PR"
STATUS="${STATUS} (⚠️ failed to notify on PR)"
}
elif [ -z "$EXIT_CODE" ]; then
STATUS="⏭️ **Review skipped** — agent did not run"
elif [ "$EXIT_CODE" != "0" ]; then
Expand Down
Loading