Skip to content
Merged
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
34 changes: 31 additions & 3 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Delphi Python Tests

on:
push:
branches: [ edge, stable ]
branches: &branches [ edge, stable ]
paths: &paths
- 'delphi/**/*.py'
- 'delphi/requirements*.txt'
- 'delphi/Dockerfile'
- '.github/workflows/python-ci.yml'
pull_request:
branches: [ edge, stable ]
branches: *branches
paths: *paths

jobs:
test:
Expand Down Expand Up @@ -116,13 +122,35 @@ jobs:
script: |
const fs = require('fs');
const commentBody = fs.readFileSync('coverage-comment.md', 'utf8');
const marker = '<!-- delphi-coverage-report -->';
const body = `${marker}\n## Delphi Coverage Report\n\n${commentBody}`;

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

const existingComment = comments.find(c => c.body.includes(marker));

if (existingComment) {
Comment thread
ballPointPenguin marked this conversation as resolved.
Resolved
// Delete existing comment so new one appears after latest commit
await github.rest.issues.deleteComment({
comment_id: existingComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
});
console.log('Existing coverage comment deleted.');
}

// Always create a new comment
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "## Coverage Report\n\n" + commentBody
body: body
});
console.log('Coverage comment posted successfully.');
} catch (error) {
Expand Down
Loading