# This file was automatically generated by github-actions-wac. # DO NOT MODIFY IT BY HAND. Instead, modify the source *.wac.ts file(s) # and run "github-actions-wac build" (or "ghawac build") to regenerate this file. # For more information, run "github-actions-wac --help". name: ๐Ÿ’ฌ PR Command - Vitest 'on': issue_comment: types: - created env: NODE_OPTIONS: '--max_old_space_size=4096' AWS_REGION: eu-central-1 jobs: checkComment: name: Check comment for /vitest if: >- ${{ github.event.issue.pull_request && (github.event.comment.body == '/vitest' || startsWith(github.event.comment.body, '/vitest ')) }} permissions: contents: read actions: write pull-requests: write issues: write outputs: comment-id: ${{ steps.create-comment.outputs.comment-id }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Check permission and react to comment env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: >- PERMISSION=$(gh api "/repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission" -q .permission) if [ "$PERMISSION" != "write" ] && [ "$PERMISSION" != "admin" ]; then echo "::error::User ${{ github.event.comment.user.login }} does not have write permission (has: $PERMISSION)." exit 1 fi HEAD_REPO=$(gh api "/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" -q ".head.repo.full_name // empty") if [ "$HEAD_REPO" != "${{ github.repository }}" ]; then echo "::error::/vitest does not run on pull requests from forks (head repository: ${HEAD_REPO:-deleted})." gh api --silent -X POST "/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" -f body="/vitest does not run on pull requests from forks." exit 1 fi gh api --silent -X POST "/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" -f content=eyes - name: Create comment id: create-comment uses: >- peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 with: issue-number: ${{ github.event.issue.number }} body: >- Vitest tests have been initiated (for more information, click [here](https://github.com/webiny/webiny-js/actions/runs/${{ github.run_id }})). :sparkles: | Group | Status | | --- | --- | | No storage | โณ Queued | | DDB | โณ Queued | | DDB+OS | โณ Queued | | SQL | โณ Queued | | pg | โณ Queued | runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false baseBranch: needs: checkComment name: Get base branch permissions: contents: read actions: write pull-requests: read outputs: base-branch: ${{ steps.base-branch.outputs.base-branch }} pr-sha: ${{ steps.pr-sha.outputs.pr-sha }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 - name: Get base branch id: base-branch env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: >- echo "base-branch=$(gh pr view ${{ github.event.issue.number }} --json baseRefName -q .baseRefName)" >> $GITHUB_OUTPUT - name: Get PR head SHA id: pr-sha env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: >- echo "pr-sha=$(gh pr view ${{ github.event.issue.number }} --json headRefOid -q .headRefOid)" >> $GITHUB_OUTPUT runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false constants: needs: baseBranch name: Create constants outputs: global-cache-key: ${{ steps.global-cache-key.outputs.global-cache-key }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Create global cache key id: global-cache-key run: >- echo "global-cache-key=${{ needs.baseBranch.outputs.base-branch }}-${{ runner.os }}-$(/bin/date -u "+%m%d")-${{ vars.RANDOM_CACHE_KEY_SUFFIX }}" >> $GITHUB_OUTPUT runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write build: name: Build needs: - baseBranch - constants runs-on: ubuntu-latest steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages key: ${{ needs.constants.outputs.global-cache-key }} - name: Install dependencies run: yarn --immutable working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Build packages run: yarn build working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Compress build cache run: >- tar -cf run-build-cache.tzst --use-compress-program=zstdmt -C "${WEBINY_JS_DIR:-.}" .webiny/cached-packages env: WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }} - name: Upload build cache uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: run-build-cache path: run-build-cache.tzst retention-days: 7 compression-level: 0 if-no-files-found: error overwrite: true env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write vitest-constants: needs: - baseBranch - build - checkComment name: Vitest (No storage) - Constants permissions: contents: read actions: write pull-requests: write outputs: vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Mark "No storage" as running continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} run: >- STATUS="๐Ÿ”„ Running" row="| No storage | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| No storage \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for No storage could not be written after 5 attempts." - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - id: list-vitest-test-commands name: List Vitest Test Commands working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- echo "vitest-test-commands=$(node .github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js '[""]')" >> "$GITHUB_OUTPUT" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-result: needs: - vitest-run - checkComment name: Vitest (No storage) - Report status permissions: contents: read actions: write pull-requests: write if: always() && needs.checkComment.result == 'success' steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Report "No storage" result continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} RESULT: ${{ needs.vitest-run.result }} run: >- mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] | select(.name | startswith("No storage / ")) | .conclusion') TOTAL=${#CONCS[@]} PASSED=0 for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then PASSED=$((PASSED + 1)); fi; done if [ "$TOTAL" -eq 0 ]; then case "$RESULT" in cancelled) STATUS="โšช Cancelled" ;; skipped) STATUS="โญ๏ธ Skipped" ;; *) STATUS="โŒ Failed" ;; esac elif [ "$PASSED" -eq "$TOTAL" ]; then STATUS="โœ… $PASSED/$TOTAL passed" else STATUS="โŒ $PASSED/$TOTAL passed" fi row="| No storage | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| No storage \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for No storage could not be written after 5 attempts." runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-run: needs: - baseBranch - constants - vitest-constants name: No storage / ${{ matrix.testCommand.title }} strategy: fail-fast: false matrix: os: - ubuntu-latest node: - 24 testCommand: ${{ fromJSON(needs.vitest-constants.outputs.vitest-test-commands) }} runs-on: ${{ matrix.os }} env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false AWS_REGION: eu-central-1 WEBINY_TEST_REDIS_URL: redis://localhost:6379 services: valkey: image: valkey/valkey:8 ports: - '6379:6379' options: >- --health-cmd "valkey-cli ping" --health-interval 2s --health-timeout 2s --health-retries 15 steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - name: Download build cache uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with: name: run-build-cache continue-on-error: true - name: Extract build cache run: >- if [ ! -f run-build-cache.tzst ]; then echo "::warning::No build cache artifact - building from scratch. This job will be slower than usual." exit 0 fi tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C "${WEBINY_JS_DIR:-.}" env: WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }} - name: Install dependencies run: yarn --immutable working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Build packages run: yarn build working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Run tests run: ${{ matrix.testCommand.cmd }} working-directory: ${{ needs.baseBranch.outputs.base-branch }} permissions: contents: read actions: write vitest-ddb-constants: needs: - baseBranch - build - checkComment name: Vitest (DDB) - Constants permissions: contents: read actions: write pull-requests: write outputs: vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Mark "DDB" as running continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} run: >- STATUS="๐Ÿ”„ Running" row="| DDB | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| DDB \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for DDB could not be written after 5 attempts." - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - id: list-vitest-test-commands name: List Vitest Test Commands working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- echo "vitest-test-commands=$(node .github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js '["ddb"]')" >> "$GITHUB_OUTPUT" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-ddb-result: needs: - vitest-ddb-run - checkComment name: Vitest (DDB) - Report status permissions: contents: read actions: write pull-requests: write if: always() && needs.checkComment.result == 'success' steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Report "DDB" result continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} RESULT: ${{ needs.vitest-ddb-run.result }} run: >- mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] | select(.name | startswith("DDB / ")) | .conclusion') TOTAL=${#CONCS[@]} PASSED=0 for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then PASSED=$((PASSED + 1)); fi; done if [ "$TOTAL" -eq 0 ]; then case "$RESULT" in cancelled) STATUS="โšช Cancelled" ;; skipped) STATUS="โญ๏ธ Skipped" ;; *) STATUS="โŒ Failed" ;; esac elif [ "$PASSED" -eq "$TOTAL" ]; then STATUS="โœ… $PASSED/$TOTAL passed" else STATUS="โŒ $PASSED/$TOTAL passed" fi row="| DDB | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| DDB \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for DDB could not be written after 5 attempts." runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-ddb-run: needs: - baseBranch - constants - vitest-ddb-constants name: DDB / ${{ matrix.testCommand.title }} strategy: fail-fast: false matrix: os: - ubuntu-latest node: - 24 testCommand: >- ${{ fromJSON(needs.vitest-ddb-constants.outputs.vitest-test-commands) }} runs-on: ${{ matrix.os }} env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false AWS_REGION: eu-central-1 WEBINY_STORAGE: ddb steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - name: Download build cache uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with: name: run-build-cache continue-on-error: true - name: Extract build cache run: >- if [ ! -f run-build-cache.tzst ]; then echo "::warning::No build cache artifact - building from scratch. This job will be slower than usual." exit 0 fi tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C "${WEBINY_JS_DIR:-.}" env: WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }} - name: Install dependencies run: yarn --immutable working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Build packages run: yarn build working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Run tests run: ${{ matrix.testCommand.cmd }} working-directory: ${{ needs.baseBranch.outputs.base-branch }} permissions: contents: read actions: write vitest-ddb-os-constants: needs: - baseBranch - build - checkComment name: Vitest (DDB+OS) - Constants permissions: contents: read actions: write pull-requests: write outputs: vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Mark "DDB+OS" as running continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} run: >- STATUS="๐Ÿ”„ Running" row="| DDB+OS | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| DDB\+OS \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for DDB+OS could not be written after 5 attempts." - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - id: list-vitest-test-commands name: List Vitest Test Commands working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- echo "vitest-test-commands=$(node .github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js '["ddb-os,ddb"]')" >> "$GITHUB_OUTPUT" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-ddb-os-result: needs: - vitest-ddb-os-run - checkComment name: Vitest (DDB+OS) - Report status permissions: contents: read actions: write pull-requests: write if: always() && needs.checkComment.result == 'success' steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Report "DDB+OS" result continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} RESULT: ${{ needs.vitest-ddb-os-run.result }} run: >- mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] | select(.name | startswith("DDB+OS / ")) | .conclusion') TOTAL=${#CONCS[@]} PASSED=0 for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then PASSED=$((PASSED + 1)); fi; done if [ "$TOTAL" -eq 0 ]; then case "$RESULT" in cancelled) STATUS="โšช Cancelled" ;; skipped) STATUS="โญ๏ธ Skipped" ;; *) STATUS="โŒ Failed" ;; esac elif [ "$PASSED" -eq "$TOTAL" ]; then STATUS="โœ… $PASSED/$TOTAL passed" else STATUS="โŒ $PASSED/$TOTAL passed" fi row="| DDB+OS | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| DDB\+OS \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for DDB+OS could not be written after 5 attempts." runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-ddb-os-run: needs: - baseBranch - constants - vitest-ddb-os-constants name: DDB+OS / ${{ matrix.testCommand.title }} strategy: fail-fast: false matrix: os: - ubuntu-latest node: - 24 testCommand: >- ${{ fromJSON(needs.vitest-ddb-os-constants.outputs.vitest-test-commands) }} runs-on: ${{ matrix.os }} env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false AWS_REGION: eu-central-1 OPENSEARCH_INDEX_PREFIX: ${{ matrix.testCommand.id }} WEBINY_STORAGE: ddb-os,ddb services: opensearch: image: opensearchproject/opensearch:3.3.2 env: discovery.type: single-node DISABLE_SECURITY_PLUGIN: 'true' OPENSEARCH_JAVA_OPTS: '-Xms512m -Xmx512m' ports: - '9200:9200' steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - name: Download build cache uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with: name: run-build-cache continue-on-error: true - name: Extract build cache run: >- if [ ! -f run-build-cache.tzst ]; then echo "::warning::No build cache artifact - building from scratch. This job will be slower than usual." exit 0 fi tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C "${WEBINY_JS_DIR:-.}" env: WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }} - name: Install dependencies run: yarn --immutable working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Build packages run: yarn build working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Wait for OpenSearch run: >- set -euo pipefail for i in $(seq 1 60); do if curl -sf "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s" > /dev/null; then echo "OpenSearch is up:" curl -s http://localhost:9200 exit 0 fi sleep 5 done echo "::error::OpenSearch did not answer on localhost:9200 within 5 minutes." exit 1 - name: Run tests run: ${{ matrix.testCommand.cmd }} working-directory: ${{ needs.baseBranch.outputs.base-branch }} permissions: contents: read actions: write vitest-sql-constants: needs: - baseBranch - build - checkComment name: Vitest (SQL) - Constants permissions: contents: read actions: write pull-requests: write outputs: vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Mark "SQL" as running continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} run: >- STATUS="๐Ÿ”„ Running" row="| SQL | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| SQL \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for SQL could not be written after 5 attempts." - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - id: list-vitest-test-commands name: List Vitest Test Commands working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- echo "vitest-test-commands=$(node .github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js '["sql"]')" >> "$GITHUB_OUTPUT" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-sql-result: needs: - vitest-sql-run - checkComment name: Vitest (SQL) - Report status permissions: contents: read actions: write pull-requests: write if: always() && needs.checkComment.result == 'success' steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Report "SQL" result continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} RESULT: ${{ needs.vitest-sql-run.result }} run: >- mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] | select(.name | startswith("SQL / ")) | .conclusion') TOTAL=${#CONCS[@]} PASSED=0 for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then PASSED=$((PASSED + 1)); fi; done if [ "$TOTAL" -eq 0 ]; then case "$RESULT" in cancelled) STATUS="โšช Cancelled" ;; skipped) STATUS="โญ๏ธ Skipped" ;; *) STATUS="โŒ Failed" ;; esac elif [ "$PASSED" -eq "$TOTAL" ]; then STATUS="โœ… $PASSED/$TOTAL passed" else STATUS="โŒ $PASSED/$TOTAL passed" fi row="| SQL | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| SQL \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for SQL could not be written after 5 attempts." runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-sql-run: needs: - baseBranch - constants - vitest-sql-constants name: SQL / ${{ matrix.testCommand.title }} strategy: fail-fast: false matrix: os: - ubuntu-latest node: - 24 testCommand: >- ${{ fromJSON(needs.vitest-sql-constants.outputs.vitest-test-commands) }} runs-on: ${{ matrix.os }} env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false AWS_REGION: eu-central-1 WEBINY_STORAGE: sql steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - name: Download build cache uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with: name: run-build-cache continue-on-error: true - name: Extract build cache run: >- if [ ! -f run-build-cache.tzst ]; then echo "::warning::No build cache artifact - building from scratch. This job will be slower than usual." exit 0 fi tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C "${WEBINY_JS_DIR:-.}" env: WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }} - name: Install dependencies run: yarn --immutable working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Build packages run: yarn build working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Run tests run: ${{ matrix.testCommand.cmd }} working-directory: ${{ needs.baseBranch.outputs.base-branch }} permissions: contents: read actions: write vitest-pg-constants: needs: - baseBranch - build - checkComment name: Vitest (pg) - Constants permissions: contents: read actions: write pull-requests: write outputs: vitest-test-commands: ${{ steps.list-vitest-test-commands.outputs.vitest-test-commands }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Mark "pg" as running continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} run: >- STATUS="๐Ÿ”„ Running" row="| pg | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| pg \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for pg could not be written after 5 attempts." - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - id: list-vitest-test-commands name: List Vitest Test Commands working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- echo "vitest-test-commands=$(node .github/workflows/wac/utils/runNodeScripts/listVitestTestCommands.js '["pg,sql"]')" >> "$GITHUB_OUTPUT" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-pg-result: needs: - vitest-pg-run - checkComment name: Vitest (pg) - Report status permissions: contents: read actions: write pull-requests: write if: always() && needs.checkComment.result == 'success' steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Report "pg" result continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} RESULT: ${{ needs.vitest-pg-run.result }} run: >- mapfile -t CONCS < <(gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] | select(.name | startswith("pg / ")) | .conclusion') TOTAL=${#CONCS[@]} PASSED=0 for c in "${CONCS[@]}"; do if [ "$c" = "success" ]; then PASSED=$((PASSED + 1)); fi; done if [ "$TOTAL" -eq 0 ]; then case "$RESULT" in cancelled) STATUS="โšช Cancelled" ;; skipped) STATUS="โญ๏ธ Skipped" ;; *) STATUS="โŒ Failed" ;; esac elif [ "$PASSED" -eq "$TOTAL" ]; then STATUS="โœ… $PASSED/$TOTAL passed" else STATUS="โŒ $PASSED/$TOTAL passed" fi row="| pg | $STATUS |" for attempt in $(seq 1 5); do gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' > /tmp/vitest-comment.txt || { echo "Could not read the status comment (attempt $attempt of 5)."; sleep 3; continue; } sed -i -E "s@^\| pg \|.*@$row@" /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt > /dev/null || { echo "Could not write the status comment (attempt $attempt of 5)."; sleep 3; continue; } sleep $((RANDOM % 4 + 3)) if gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body' | grep -qxF "$row"; then echo "Row written: $row" exit 0 fi echo "Another job's write replaced the row (attempt $attempt of 5)." done echo "::warning::The status comment row for pg could not be written after 5 attempts." runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false vitest-pg-run: needs: - baseBranch - constants - vitest-pg-constants name: pg / ${{ matrix.testCommand.title }} strategy: fail-fast: false matrix: os: - ubuntu-latest node: - 24 testCommand: >- ${{ fromJSON(needs.vitest-pg-constants.outputs.vitest-test-commands) }} runs-on: ${{ matrix.os }} env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false AWS_REGION: eu-central-1 WEBINY_STORAGE: pg,sql WEBINY_SQL_CLIENT: pglite steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: ${{ needs.baseBranch.outputs.base-branch }} - name: Checkout Pull Request working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: >- git fetch --no-tags origin refs/pull/${{ github.event.issue.number }}/head git checkout --detach ${{ needs.baseBranch.outputs.pr-sha }} - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: ${{ needs.baseBranch.outputs.base-branch }} run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - name: Download build cache uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with: name: run-build-cache continue-on-error: true - name: Extract build cache run: >- if [ ! -f run-build-cache.tzst ]; then echo "::warning::No build cache artifact - building from scratch. This job will be slower than usual." exit 0 fi tar -xf run-build-cache.tzst --use-compress-program=zstdmt -C "${WEBINY_JS_DIR:-.}" env: WEBINY_JS_DIR: ${{ needs.baseBranch.outputs.base-branch }} - name: Install dependencies run: yarn --immutable working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Build packages run: yarn build working-directory: ${{ needs.baseBranch.outputs.base-branch }} - name: Run tests run: ${{ matrix.testCommand.cmd }} working-directory: ${{ needs.baseBranch.outputs.base-branch }} permissions: contents: read actions: write vitestStatusSummary: name: Vitest status summary permissions: contents: read actions: write pull-requests: write needs: - checkComment - vitest-run - vitest-ddb-run - vitest-ddb-os-run - vitest-sql-run - vitest-pg-run - vitest-result - vitest-ddb-result - vitest-ddb-os-result - vitest-sql-result - vitest-pg-result if: always() && needs.checkComment.result == 'success' env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMENT_ID: ${{ needs.checkComment.outputs.comment-id }} COMMENT_INTRO: >- Vitest tests have been initiated (for more information, click [here](https://github.com/webiny/webiny-js/actions/runs/${{ github.run_id }})). :sparkles: PR_NUMBER: ${{ github.event.issue.number }} R_NONE: ${{ needs.vitest-run.result }} R_DDB: ${{ needs.vitest-ddb-run.result }} R_DDB_OS: ${{ needs.vitest-ddb-os-run.result }} R_SQL: ${{ needs.vitest-sql-run.result }} R_PG: ${{ needs.vitest-pg-run.result }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Heal PR comment and update PR description continue-on-error: true run: >- gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" --jq '.jobs[] | [.name, .conclusion] | @tsv' > /tmp/jobs.tsv status_for() { local prefix="$1" fallback="$2" total passed total=$(awk -F'\t' -v p="$prefix" 'index($1,p)==1{n++} END{print n+0}' /tmp/jobs.tsv) if [ "$total" -eq 0 ]; then case "$fallback" in success) echo "โœ… Passed" ;; cancelled) echo "โšช Cancelled" ;; skipped) echo "โญ๏ธ Skipped" ;; *) echo "โŒ Failed" ;; esac return fi passed=$(awk -F'\t' -v p="$prefix" 'index($1,p)==1 && $2=="success"{n++} END{print n+0}' /tmp/jobs.tsv) if [ "$passed" -eq "$total" ]; then echo "โœ… $passed/$total passed"; else echo "โŒ $passed/$total passed"; fi } : > /tmp/failed.txt add_failed() { local list list=$(awk -F'\t' -v p="$1" 'index($1,p)==1 && $2=="failure"{ x=substr($1,length(p)+1); sub(/^\[[^]]*\] /,"",x); print "- " x }' /tmp/jobs.tsv) if [ -n "$list" ]; then { echo "**$2**"; echo "$list"; echo ""; } >> /tmp/failed.txt; fi } add_failed "No storage / " "No storage" add_failed "DDB / " "DDB" add_failed "DDB+OS / " "DDB+OS" add_failed "SQL / " "SQL" add_failed "pg / " "pg" S_NONE=$(status_for "No storage / " "$R_NONE") S_DDB=$(status_for "DDB / " "$R_DDB") S_DDB_OS=$(status_for "DDB+OS / " "$R_DDB_OS") S_SQL=$(status_for "SQL / " "$R_SQL") S_PG=$(status_for "pg / " "$R_PG") render_table() { echo "| Group | Status |" echo "| --- | --- |" echo "| No storage | $S_NONE |" echo "| DDB | $S_DDB |" echo "| DDB+OS | $S_DDB_OS |" echo "| SQL | $S_SQL |" echo "| pg | $S_PG |" if [ -s /tmp/failed.txt ]; then echo "" echo "
โŒ Failed packages" echo "" cat /tmp/failed.txt echo "
" fi } # Heal the PR comment with the authoritative final status. { echo "$COMMENT_INTRO"; echo ""; render_table; } > /tmp/vitest-comment.txt gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH --field body=@/tmp/vitest-comment.txt # Build the PR description status block (idempotent via markers). { echo ""; echo "### ๐Ÿงช Vitest results"; echo ""; render_table; echo ""; } > /tmp/vitest-status.md gh pr view "$PR_NUMBER" -R ${{ github.repository }} --json body -q .body > /tmp/pr-body-raw.txt # Drop any existing status block, then trailing blank lines, so re-runs don't stack separators. sed '//,//d' /tmp/pr-body-raw.txt > /tmp/pr-body-noblock.txt awk 'NF{p=NR} {a[NR]=$0} END{for(i=1;i<=p;i++) print a[i]}' /tmp/pr-body-noblock.txt > /tmp/pr-body-trimmed.txt { cat /tmp/pr-body-trimmed.txt; echo ""; cat /tmp/vitest-status.md; } > /tmp/pr-body.txt gh pr edit "$PR_NUMBER" -R ${{ github.repository }} --body-file /tmp/pr-body.txt runs-on: ubuntu-latest