Skip to content
Open
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
58 changes: 3 additions & 55 deletions .github/workflows/tests-rs-sdk-grpc-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand All @@ -45,13 +44,9 @@ jobs:
- name: Check gRPC coverage
id: coverage
run: |
# Run the coverage check
if python .github/scripts/check-grpc-coverage.py; then
echo "status=success" >> $GITHUB_OUTPUT
else
echo "status=failure" >> $GITHUB_OUTPUT
fi

# Run the coverage check — script exits non-zero if new queries are missing
python .github/scripts/check-grpc-coverage.py

# Check if cache was modified
if git diff --quiet .github/grpc-queries-cache.json; then
echo "cache_modified=false" >> $GITHUB_OUTPUT
Expand All @@ -74,50 +69,3 @@ jobs:
with:
name: grpc-coverage-report
path: grpc-coverage-report.txt

- name: Comment PR
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && (steps.coverage.outputs.cache_modified == 'true' || steps.coverage.outputs.status == 'failure')
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const reportPath = 'grpc-coverage-report.txt';

if (fs.existsSync(reportPath)) {
const report = fs.readFileSync(reportPath, 'utf8');
const status = '${{ steps.coverage.outputs.status }}' === 'success' ? '✅' : '❌';

// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('gRPC Query Coverage Report')
);

const body = `### ${status} gRPC Query Coverage Report\n\n\`\`\`\n${report}\n\`\`\``;

if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: body
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
}
}

- name: Fail if new queries are missing
if: steps.coverage.outputs.status == 'failure'
run: exit 1
Loading