@@ -48,6 +48,7 @@ open class CommonSettingsPlugin
4848 }
4949 }
5050
51+ // TODO: this task is deprecated and should be removed once all projects are migrated to GHA
5152 settings.gradle.rootProject {
5253 tasks.register(" storeProjectVersion" ) {
5354 group = " build"
@@ -112,18 +113,26 @@ open class CommonSettingsPlugin
112113 }
113114 }
114115
115- tag(if (System .getenv(" CI" ).isNullOrEmpty()) " local" else " CI" )
116+ // See https://docs.github.com/en/actions/reference/workflows-and-actions/variables for GHA env vars reference
117+ tag(if (isCI) " local" else " CI" )
116118 tag(System .getProperty(" os.name" ))
117- if (System .getenv(" CIRRUS_BRANCH" ) == " master" ) {
119+ val branch = System .getenv(" CIRRUS_BRANCH" ) ? : System .getenv(" GITHUB_REF_NAME" )
120+ if (branch == " master" ) {
118121 tag(" master" )
119122 }
120- if (System .getenv(" CIRRUS_PR" )?.isBlank() == false ) {
123+ val isPr = (System .getenv(" CIRRUS_PR" )?.isBlank() == false )
124+ .or (System .getenv(" GITHUB_REF_NAME" )?.endsWith(" /merge" ) == true )
125+ if (isPr) {
121126 tag(" PR" )
122127 }
123128 value(" Build Number" , System .getenv(" BUILD_NUMBER" ))
124- value(" Branch" , System .getenv(" CIRRUS_BRANCH" ))
125- value(" PR" , System .getenv(" CIRRUS_PR" ))
126- value(" PR Title" , System .getenv(" CIRRUS_PR_TITLE" ))
129+ value(" Branch" , branch)
130+ val prNumber = if (isPr) {
131+ System .getenv(" CIRRUS_PR" ) ? : System .getenv(" GITHUB_REF_NAME" )?.substringBeforeLast(" /merge" )
132+ } else {
133+ null
134+ }
135+ value(" PR" , prNumber)
127136
128137 capture {
129138 // `properties` task can log sensitive information, so we disable uploading of build logs for it
0 commit comments