Skip to content

Commit ed95073

Browse files
authored
Merge pull request #82 from Songmu/fix-tagpr-detection
strict commit detection logic for tagging targets, just in case
2 parents 3e0720f + 594bca7 commit ed95073

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tagpr.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const (
2525
autoCommitMessage = "[tagpr] prepare for the next release"
2626
autoChangelogMessage = "[tagpr] update CHANGELOG.md"
2727
autoLableName = "tagpr"
28+
branchPrefix = "tagpr-from-"
2829
)
2930

3031
type tagpr struct {
@@ -93,7 +94,7 @@ func newTagPR(ctx context.Context, c *commander) (*tagpr, error) {
9394
}
9495

9596
func isTagPR(pr *github.PullRequest) bool {
96-
if pr == nil {
97+
if pr == nil || pr.Head == nil || pr.Head.Ref == nil || !strings.HasPrefix(*pr.Head.Ref, branchPrefix) {
9798
return false
9899
}
99100
for _, label := range pr.Labels {
@@ -167,7 +168,7 @@ func (tp *tagpr) Run(ctx context.Context) error {
167168
return tp.tagRelease(ctx, pr, currVer, latestSemverTag)
168169
}
169170

170-
rcBranch := fmt.Sprintf("tagpr-from-%s", currVer.Tag())
171+
rcBranch := fmt.Sprintf("%s%s", branchPrefix, currVer.Tag())
171172
tp.c.Git("branch", "-D", rcBranch)
172173
if _, _, err := tp.c.Git("checkout", "-b", rcBranch); err != nil {
173174
return err

0 commit comments

Comments
 (0)