diff --git a/CHANGELOG.md b/CHANGELOG.md index a37e1e0..7de6738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Fixed ref labels on PRs using PR head branch instead of base ## [0.0.8] - 2024-03-16 ### Added diff --git a/collector.go b/collector.go index e08a4cb..a12060b 100644 --- a/collector.go +++ b/collector.go @@ -259,11 +259,11 @@ func makeRef(run *github.WorkflowRun) string { } for _, pr := range run.PullRequests { - prBaseBranch := pr.GetBase() + prHeadBranch := pr.GetHead() - if prBaseBranch.GetSHA() == headSha || - prBaseBranch.GetRef() == headBranch { - return headBranch + if prHeadBranch.GetSHA() == headSha || + prHeadBranch.GetRef() == headBranch { + return pr.GetBase().GetRef() } }