Fix GitHub Autocomment for ci-run/prs (#5268)

## 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` 🤦
This commit is contained in:
Alexander Bayandin
2023-09-10 20:06:10 +01:00
committed by GitHub
parent 34e39645c4
commit 15fd188fd6

View File

@@ -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-(?<prNumber>\d+)/)?.groups
if (match) {
({ prNumber } = match)