Skip to content

Commit eed8391

Browse files
authored
Merge pull request Expensify#72554 from software-mansion-labs/enable-artifacts-for-adhocs
[No QA] Use Android react-native prebuilds in adhoc workflow
2 parents 9284d17 + a3bbf41 commit eed8391

3 files changed

Lines changed: 43 additions & 6 deletions

File tree

.github/workflows/testBuild.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ jobs:
352352
ANDROID_UPLOAD_KEYSTORE_PASSWORD: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}
353353
ANDROID_UPLOAD_KEYSTORE_ALIAS: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
354354
ANDROID_UPLOAD_KEY_PASSWORD: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }}
355+
GITHUB_ACTOR: ${{ github.actor }}
356+
GITHUB_TOKEN: ${{ github.token }}
355357
run: bundle exec fastlane android build_adhoc_hybrid
356358

357359
- name: Configure AWS Credentials

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@
254254
"GDSO",
255255
"genkey",
256256
"GEOLOCATION",
257+
"getenv",
257258
"getprop",
258259
"gibsdk",
259260
"glcode",

gradleUtils/PatchedArtifactsSettings.gradle

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,62 @@ def hasGithubCLI() {
3232
return runCommand(["which", "gh"]).exitCode == 0
3333
}
3434

35+
def isCIEnvironment() {
36+
return System.getenv("CI") != null
37+
}
38+
3539
def hasRequiredScopes() {
3640
def scopes = runCommand(["gh", "auth", "status"]).output
3741
return ['read:packages', 'write:packages'].any { scope -> scopes.contains(scope) }
3842
}
3943

44+
def getCIGithubActor() {
45+
return System.getenv("GITHUB_ACTOR")
46+
}
47+
48+
def getCIGithubToken() {
49+
return System.getenv("GITHUB_TOKEN")
50+
}
51+
52+
def hasRequiredCIEnvs() {
53+
return getCIGithubActor() != null && getCIGithubToken() != null
54+
}
55+
4056
def getGithubUsername() {
57+
if (isCIEnvironment()) {
58+
return getCIGithubActor()
59+
}
4160
return new JsonSlurper().parseText(runCommand(["gh", "api", "user"]).output).login
4261
}
4362

4463
def getGithubToken() {
64+
if (isCIEnvironment()) {
65+
return getCIGithubToken()
66+
}
4567
return runCommand(["gh", "auth", "token"]).output
4668
}
4769

48-
def getCredentials() {
70+
def validateCredentialsContext() {
4971
if (!hasGithubCLI()) {
50-
warnIfNotConfigured("No Github CLI found.")
51-
return null
72+
return "No Github CLI found."
5273
}
5374

54-
try {
55-
if(!hasRequiredScopes()) {
56-
warnIfNotConfigured("Github token does not have required scope read:packages.")
75+
if (isCIEnvironment() && !hasRequiredCIEnvs()) {
76+
return "Missing required CI environment variables GITHUB_ACTOR and/or GITHUB_TOKEN."
77+
}
78+
79+
if (!isCIEnvironment() && !hasRequiredScopes()) {
80+
return "Github token does not have required scope read:packages."
81+
}
82+
83+
return null
84+
}
85+
86+
def getCredentials() {
87+
try {
88+
def validationErrorMessage = validateCredentialsContext()
89+
if (validationErrorMessage != null) {
90+
warnIfNotConfigured(validationErrorMessage)
5791
return null
5892
}
5993

0 commit comments

Comments
 (0)