mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Fix spotless ratcheting on release branches (#1401)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -142,9 +142,17 @@ private fun KotlinGradleExtension.configureFormatter() {
|
||||
}
|
||||
|
||||
val originalRemoteName = System.getenv("PKL_ORIGINAL_REMOTE_NAME") ?: "origin"
|
||||
// if we're running against a release branch (or a PR targeted at one), use that branch for
|
||||
// ratcheting
|
||||
// these env vars are set by GitHub actions:
|
||||
// https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables
|
||||
val ratchetBranchName =
|
||||
(System.getenv("GITHUB_BASE_REF") ?: System.getenv("GITHUB_REF_NAME"))?.let {
|
||||
if (it.startsWith("release/")) it else null
|
||||
} ?: "main"
|
||||
|
||||
spotless {
|
||||
ratchetFrom = "$originalRemoteName/main"
|
||||
ratchetFrom = "$originalRemoteName/$ratchetBranchName"
|
||||
|
||||
// When building root project, format buildSrc files too.
|
||||
// We need this because buildSrc is not a subproject of the root project, so a top-level
|
||||
|
||||
Reference in New Issue
Block a user