Improve CI commenter

This commit is contained in:
Peter Steinberger 2025-06-23 00:10:19 +02:00
parent ad90606f73
commit 9424ad27ca

View file

@ -19,6 +19,7 @@ jobs:
steps:
- name: Check CI Status
uses: actions/github-script@v7
id: check-status
with:
script: |
const workflow_run = context.payload.workflow_run;
@ -59,10 +60,30 @@ jobs:
}
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: comment
});
}
// Store comment body for next step
core.setOutput('comment_body', comment);
core.setOutput('pr_number', pr.number.toString());
core.setOutput('should_comment', 'true');
} else {
core.setOutput('should_comment', 'false');
}
- name: Find Comment
if: steps.check-status.outputs.should_comment == 'true'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ steps.check-status.outputs.pr_number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- vibetunnel-ci-status -->'
- name: Create or Update Comment
if: steps.check-status.outputs.should_comment == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.check-status.outputs.pr_number }}
body: |
<!-- vibetunnel-ci-status -->
${{ steps.check-status.outputs.comment_body }}
edit-mode: replace