Skip to content

chore(deps): bump the npm_and_yarn group across 1 directory with 3 updates #2988

chore(deps): bump the npm_and_yarn group across 1 directory with 3 updates

chore(deps): bump the npm_and_yarn group across 1 directory with 3 updates #2988

Workflow file for this run

name: PR Coverage Report
on:
pull_request:
branches: [main]
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
coverage:
name: Coverage Report
runs-on: ubuntu-latest
# Non-blocking: never prevent merging even if this job fails
continue-on-error: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 20
cache: pnpm
- name: Install tmux
run: sudo apt-get update && sudo apt-get install -y tmux
- name: Start tmux server
run: tmux start-server
- run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm -r --filter '!@aoagents/ao-web' build
- name: Get changed files
env:
BASE_REF: ${{ github.base_ref }}
run: |
git diff --name-only origin/$BASE_REF...HEAD -- '*.ts' '*.tsx' > changed-files.txt
echo "Changed TS files:"
cat changed-files.txt
- name: Run tests with coverage
continue-on-error: true
run: |
CHANGED=$(cat changed-files.txt)
# Only run coverage for packages that have changed files
if echo "$CHANGED" | grep -q '^packages/core/'; then
echo "::group::Core tests"
pnpm --filter @aoagents/ao-core exec vitest run --coverage.enabled --coverage.reporter=json || true
echo "::endgroup::"
fi
if echo "$CHANGED" | grep -q '^packages/cli/'; then
echo "::group::CLI tests"
pnpm --filter @aoagents/ao-cli exec vitest run --coverage.enabled --coverage.reporter=json || true
echo "::endgroup::"
fi
if echo "$CHANGED" | grep -q '^packages/web/'; then
echo "::group::Web tests"
pnpm --filter @aoagents/ao-web exec vitest run --coverage.enabled --coverage.reporter=json || true
echo "::endgroup::"
fi
if echo "$CHANGED" | grep -q '^packages/plugins/'; then
# Run coverage for each changed plugin
for plugin_dir in $(echo "$CHANGED" | grep '^packages/plugins/' | cut -d/ -f1-3 | sort -u); do
if [ -f "$plugin_dir/package.json" ]; then
pkg_name=$(jq -r .name "$plugin_dir/package.json")
echo "::group::$pkg_name tests"
pnpm --filter "$pkg_name" exec vitest run --coverage.enabled --coverage.reporter=json || true
echo "::endgroup::"
fi
done
fi
- name: Generate coverage report
run: node .github/scripts/coverage-report.mjs
- name: Post or update PR comment
# Fork PR tokens lack comment permissions — don't fail the job
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
REPO=${{ github.repository }}
COMMENT_TAG="<!-- coverage-report -->"
# Find existing coverage comment
COMMENT_ID=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" \
--paginate --jq ".[] | select(.body | startswith(\"$COMMENT_TAG\")) | .id" \
| tail -1)
if [ -n "$COMMENT_ID" ]; then
# Update may fail on fork PRs (403) — fall back to creating a new comment
if gh api "repos/$REPO/issues/comments/$COMMENT_ID" \
-X PATCH \
-F body=@coverage-comment.md 2>/dev/null; then
echo "Updated existing comment $COMMENT_ID"
else
echo "Could not update comment $COMMENT_ID, creating new one"
gh pr comment "$PR_NUMBER" --body-file coverage-comment.md
echo "Created new comment"
fi
else
gh pr comment "$PR_NUMBER" --body-file coverage-comment.md
echo "Created new comment"
fi