From 15fd188fd693b8f2298b74cf9f378ea94865fa91 Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Sun, 10 Sep 2023 20:06:10 +0100 Subject: [PATCH] Fix GitHub Autocomment for `ci-run/pr`s (#5268) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem When PR `ci-run/pr-*` is created the GitHub Autocomment with test results are supposed to be posted to the original PR, currently, this doesn't work. I created this PR from a personal fork to debug and fix the issue. ## Summary of changes - `scripts/comment-test-report.js`: use `pull_request.head` instead of `pull_request.base` 🤦 --- scripts/comment-test-report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/comment-test-report.js b/scripts/comment-test-report.js index 07fb35cfc5..89befda71f 100755 --- a/scripts/comment-test-report.js +++ b/scripts/comment-test-report.js @@ -210,7 +210,7 @@ module.exports = async ({ github, context, fetch, report, coverage }) => { // Which PR to comment (for ci-run/pr-* it will comment the parent PR, not the ci-run/pr-* PR) let prToComment if (isPullRequest) { - const branchName = context.payload.pull_request.base.ref.replace(/^refs\/heads\//, "") + const branchName = context.payload.pull_request.head.ref.replace(/^refs\/heads\//, "") const match = branchName.match(/ci-run\/pr-(?\d+)/)?.groups if (match) { ({ prNumber } = match)