expo / expo-github-action

Expo GitHub Action makes it easy to automate EAS builds or updates
MIT License
771 stars 75 forks source link

Improve existing build filtering for `continuous-deploy-fingerprint` action #301

Closed tharakadesilva closed 3 hours ago

tharakadesilva commented 2 weeks ago

Description of the feature

Improve the build filtering in the continuous-deploy-fingerprint GitHub action to prevent duplicate builds from being triggered.

Motivation

The current implementation uses --status finished when querying for existing builds, which can lead to unnecessary new builds even when there's an existing build for the same runtime version. This results in wasted CI resources. By implementing a more comprehensive filtering approach, we can save CI resources and improve the efficiency of the deployment process.

Additional context

The issue is in the getBuildInfoWithFingerprintAsync function in the file: https://sourcegraph.com/github.com/expo/expo-github-action/-/blob/src/actions/continuous-deploy-fingerprint.ts?L133-197

Currently, the function uses the following command to list builds:

eas build:list --platform ${platform} --status finished --buildProfile ${profile} --runtimeVersion ${fingerprintHash} --limit 1 --json --non-interactive

The --status finished filter is too restrictive and doesn't account for builds that might be in progress or queued. The eas build:list command supports the following status values: new, in-queue, in-progress, pending-cancel, errored, finished, canceled.

Proposed solution:

  1. Remove the --status finished filter from the eas build:list command.
  2. Implement frontend filtering in the action to exclude builds with status pending-cancel, errored, and canceled.
  3. Consider builds with status new, in-queue, in-progress, or finished as valid existing builds to prevent triggering duplicate builds.

This change would require modifying the getBuildInfoWithFingerprintAsync function to:

  1. Remove the --status finished parameter from the eas build:list command.
  2. Parse the JSON output to filter out unwanted build statuses.
  3. Return the most recent valid build or null if no valid builds are found.

By implementing this feature, we can significantly reduce unnecessary builds, saving CI resources and improving the overall efficiency of the continuous deployment process.

wschurman commented 1 week ago

Good feedback! Will look into this as fingerprint moves out of beta!

tharakadesilva commented 1 week ago

Thanks and thanks for the amazing work, love the entire flow with fingerprinting!