Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewGable committed Nov 11, 2024
1 parent 379c3ac commit b1b7d75
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
36 changes: 25 additions & 11 deletions .github/actions/javascript/checkAndroidStatus/checkAndroidStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ async function checkAndroidStatus() {

const androidApi = google.androidpublisher({
version: 'v3',
auth: auth,
auth,
});

try {
// Insert an edit to get an edit ID
const editResponse = await androidApi.edits.insert({
packageName: PACKAGE_NAME,
});
const editId = editResponse.data.id;
const editId = editResponse.data.id ?? 'undefined';

// Get the production track status
const trackResponse = await androidApi.edits.tracks.get({
packageName: PACKAGE_NAME,
editId: editId!,
editId,
track: 'production',
});

const status = trackResponse.data.releases?.[0]?.status || 'undefined';
const status = trackResponse.data.releases?.[0]?.status ?? 'undefined';
console.log('Track status:', status);

// Check if the status is halted
Expand Down Expand Up @@ -65,13 +65,27 @@ function calculateRolloutPercentage(releaseDate: string): number {
const daysSinceRelease = Math.floor((current.getTime() - release.getTime()) / (1000 * 60 * 60 * 24));
console.log('Days since release:', daysSinceRelease);

if (daysSinceRelease <= 0) return 0;
if (daysSinceRelease === 1) return 0.01;
if (daysSinceRelease === 2) return 0.02;
if (daysSinceRelease === 3) return 0.05;
if (daysSinceRelease === 4) return 0.1;
if (daysSinceRelease === 5) return 0.2;
if (daysSinceRelease === 6) return 0.5;
if (daysSinceRelease <= 0) {
return 0;
}
if (daysSinceRelease === 1) {
return 0.01;
}
if (daysSinceRelease === 2) {
return 0.02;
}
if (daysSinceRelease === 3) {
return 0.05;
}
if (daysSinceRelease === 4) {
return 0.1;
}
if (daysSinceRelease === 5) {
return 0.2;
}
if (daysSinceRelease === 6) {
return 0.5;
}
return 1;
}

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/androidBump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Android Rollout Bumper
on:
# schedule:
# - cron: '0 0 * * *' # Runs at midnight every day
# TODO: Remove when done testing
push:
branches:
- andrew-android-bump
Expand Down Expand Up @@ -31,5 +32,6 @@ jobs:

- name: Update Rollout Percentage with Fastlane
run: |
# TODO: Write a fastlane lane to bump given a percentage
echo "HALTED: ${{ steps.checkAndroidStatus.outputs.HALTED }}"
echo "ROLLOUT_PERCENTAGE: ${{ steps.checkAndroidStatus.outputs.ROLLOUT_PERCENTAGE }}"

0 comments on commit b1b7d75

Please sign in to comment.