Skip to content

[build-tools] Add read app config and package.json functions #3585

Merged
gwdp merged 10 commits intomainfrom
gwdp/add-read-package-app-functions
Apr 10, 2026
Merged

[build-tools] Add read app config and package.json functions #3585
gwdp merged 10 commits intomainfrom
gwdp/add-read-package-app-functions

Conversation

@gwdp
Copy link
Copy Markdown
Contributor

@gwdp gwdp commented Apr 8, 2026

Why

Needing to add this information in the fingerprint job and thought about creating reusable steps that we can add into others as needed.

Ref ENG-20510

How

Creating 2 new functions that reuse existing utils functions to leverage SDK check and standard error messages.
Export app config basic values so devs can leverage it to get slug, name and version.

Test Plan

  • eas-cli yarn build
  • workflow-orchestration process-compose up
  • www yarn start:docker (impersonate staging first)
  • website yarn start:local
  • EXPO_LOCAL=1 npx eas-cli@latest workflow:run fingerprint-test.yml on
name: fingerprint-test

on:
  push:
    branches: ["main"]

jobs:
  project_metadata:
    name: Read project metadata
    type: custom
    runs_on: linux-medium
    environment: preview
    env:
      APP_VARIANT: preview
    outputs:
      app_config: ${{ steps.read_app_config.outputs.app_config }}
      package_json: ${{ steps.read_package_json.outputs.package_json }}
    steps:
      - uses: eas/checkout
      - uses: eas/install_node_modules
      - id: read_app_config
        uses: eas/read_app_config
      - id: read_package_json
        uses: eas/read_package_json
      # inline read
      - run: |
          APP_CONFIG='${{ steps.read_app_config.outputs.app_config }}'
          PACKAGE_JSON='${{ steps.read_package_json.outputs.package_json }}'
          echo "app_config output length: ${#APP_CONFIG}"
          echo "app_config output: ${APP_CONFIG}"
          echo "package_json output length: ${#PACKAGE_JSON}"
          echo "package_json output: ${PACKAGE_JSON}"
          node -e "JSON.parse(process.argv[1]); JSON.parse(process.argv[2]); console.log('Step outputs are readable JSON.')" "$APP_CONFIG" "$PACKAGE_JSON"

  verify_project_metadata_outputs:
    name: Verify project metadata outputs
    type: custom
    runs_on: linux-medium
    needs: [project_metadata]
    steps:
      - run: |
          APP_CONFIG='${{ needs.project_metadata.outputs.app_config }}'
          PACKAGE_JSON='${{ needs.project_metadata.outputs.package_json }}'
          echo "project_metadata.app_config: $APP_CONFIG"
          echo "project_metadata.package_json: $PACKAGE_JSON"

  fingerprint:
    name: Fingerprint
    type: fingerprint
    environment: preview
    env:
      APP_VARIANT: preview

  verify_fingerprint_job_outputs:
    name: Verify fingerprint job outputs
    type: custom
    runs_on: linux-medium
    needs: [fingerprint]
    steps:
      - run: |
          APP_CONFIG='${{ needs.fingerprint.outputs.app_config }}'
          PACKAGE_JSON='${{ needs.fingerprint.outputs.package_json }}'
          ANDROID_FINGERPRINT_HASH='${{ needs.fingerprint.outputs.android_fingerprint_hash }}'
          IOS_FINGERPRINT_HASH='${{ needs.fingerprint.outputs.ios_fingerprint_hash }}'
          echo "fingerprint.app_config: $APP_CONFIG"
          echo "fingerprint.package_json: $PACKAGE_JSON"
          echo "fingerprint.android_fingerprint_hash: $ANDROID_FINGERPRINT_HASH"
          echo "fingerprint.ios_fingerprint_hash: $IOS_FINGERPRINT_HASH"

Produced the Following
Screenshot 2026-04-10 at 2 52 01 PM
Screenshot 2026-04-10 at 2 55 20 PM
Screenshot 2026-04-10 at 2 55 30 PM
Screenshot 2026-04-10 at 2 55 35 PM
Screenshot 2026-04-10 at 2 55 44 PM

  • Failure test was done through manually crafted exception in the readPackageJson and readAppConfig (since uploading invalid ones weren't possible with the cli). Result is the following (no job failure as expected; Error message will be accordingly to failure. Seeing `test due to manually introduced exception for that test):
Screenshot 2026-04-09 at 2 49 39 PM Screenshot 2026-04-09 at 2 49 45 PM

@gwdp gwdp force-pushed the gwdp/add-read-package-app-functions branch from 0d7e5d1 to 6487637 Compare April 8, 2026 20:36
@gwdp
Copy link
Copy Markdown
Contributor Author

gwdp commented Apr 8, 2026

@linear
Copy link
Copy Markdown

linear bot commented Apr 8, 2026

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.84%. Comparing base (3155fc2) to head (d94cb76).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3585      +/-   ##
==========================================
+ Coverage   54.80%   54.84%   +0.04%     
==========================================
  Files         834      836       +2     
  Lines       35855    35886      +31     
  Branches     7487     7488       +1     
==========================================
+ Hits        19648    19679      +31     
  Misses      16112    16112              
  Partials       95       95              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fn: async (stepCtx, { env }) => {
const metadata = stepCtx.global.staticContext.metadata as Metadata | undefined;
const appConfig = (
await readAppConfig({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as npx expo config --type public --json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the early feedback @EvanBacon — I ended up using readAppConfig here because it handles SDK-version differences and includes some resiliency/fallback behavior. If you’d prefer the simpler path, I can switch this to a direct CLI call. Thoughts?

@gwdp gwdp force-pushed the gwdp/add-read-package-app-functions branch from c92d958 to 85af270 Compare April 9, 2026 21:30
@gwdp gwdp marked this pull request as ready for review April 9, 2026 21:54
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

@gwdp gwdp requested review from EvanBacon and sjchmiela April 9, 2026 21:54
@gwdp gwdp self-assigned this Apr 9, 2026
gwdp added 10 commits April 10, 2026 14:03
Add new eas/read_package_json and eas/read_app_config workflow functions and register them so fingerprint jobs can log project metadata consistently with build setup.

# Conflicts:
#	CHANGELOG.md
Move the fingerprint workflow read-step entry from Bug fixes to New features in the main changelog section.

# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
…p fields

Avoid failing build steps when app config or package.json cannot be read, and expose app name/slug/version from read_app_config output with test coverage for success and failure paths.
# Conflicts:
#	CHANGELOG.md
Deduplicate package.json read-and-log behavior between setup and readPackageJson step so both paths stay in sync, and add focused test coverage for the shared helper.
Switch the readAppConfig step to emit a single serialized app_config output and update unit tests to assert the new output shape.
@gwdp gwdp force-pushed the gwdp/add-read-package-app-functions branch from 02fc0b9 to d94cb76 Compare April 10, 2026 21:05
@github-actions
Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@gwdp gwdp merged commit 4d74298 into main Apr 10, 2026
10 checks passed
@gwdp gwdp deleted the gwdp/add-read-package-app-functions branch April 10, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants