Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: detect PR from branch for workflow_dispatch comments

Bosch05b1bd520607
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index c867ed7f..fa959ba3 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -52,7 +52,7 @@ jobs:
retention-days: 7
- name: Post PR comment
- if: always() && github.event_name == 'pull_request'
+ if: always()
uses: actions/github-script@v7
with:
script: |
@@ -66,11 +66,34 @@ jobs:
body += '⚠️ No test report generated. Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).';
}
+ // Find PR for this branch
+ let prNumber = context.issue?.number;
+
+ if (!prNumber) {
+ // Try to find PR by branch name
+ const branch = context.ref.replace('refs/heads/', '');
+ const { data: prs } = await github.rest.pulls.list({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ head: `${context.repo.owner}:${branch}`,
+ state: 'open'
+ });
+
+ if (prs.length > 0) {
+ prNumber = prs[0].number;
+ }
+ }
+
+ if (!prNumber) {
+ console.log('No open PR found for this branch, skipping comment');
+ return;
+ }
+
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
- issue_number: context.issue.number
+ issue_number: prNumber
});
const botComment = comments.find(c =>
@@ -88,10 +111,12 @@ jobs:
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
- issue_number: context.issue.number,
+ issue_number: prNumber,
body
});
}
+
+ console.log(`Posted comment to PR #${prNumber}`);
- name: Show logs on failure
if: failure()