Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
DCD_EAS_APP_VERSION: ${{ needs.build_android.outputs.app_version }}
DCD_GH_SHA: ${{ github.sha }}
DCD_GH_BRANCH: ${{ github.ref_name }}
DCD_CHECK_NAME: Android
outputs:
console_url: ${{ steps.dcd.outputs.console_url }}
status: ${{ steps.dcd.outputs.upload_status }}
Expand Down
1 change: 1 addition & 0 deletions examples/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
DCD_EAS_APP_VERSION: ${{ needs.build_ios.outputs.app_version }}
DCD_GH_SHA: ${{ github.sha }}
DCD_GH_BRANCH: ${{ github.ref_name }}
DCD_CHECK_NAME: iOS
outputs:
console_url: ${{ steps.dcd.outputs.console_url }}
status: ${{ steps.dcd.outputs.upload_status }}
Expand Down
9 changes: 9 additions & 0 deletions src/methods/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ describe('getEnv', () => {
expect(metadata).toContain('gh_branch=main');
});

it('maps DCD_CHECK_NAME so each job posts its own GitHub check', () => {
// Two jobs on one commit otherwise post identically named checks, which
// branch protection can only hold as a single required entry.
vi.stubEnv('DEVICE_CLOUD_API_KEY', 'k');
vi.stubEnv('DCD_CHECK_NAME', 'iOS smoke');

expect(getEnv().metadata).toContain('gh_check_name=iOS smoke');
});

it('skips metadata entries whose source env var is unset or empty', () => {
vi.stubEnv('DEVICE_CLOUD_API_KEY', 'k');
vi.stubEnv('DCD_EAS_BUILD_ID', 'build-123');
Expand Down
5 changes: 5 additions & 0 deletions src/methods/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const metadataMappings: Array<[envVar: string, metadataKey: string]> = [
['DCD_GH_PR_URL', 'gh_pr_url'],
['DCD_GH_REPO', 'gh_repo'],
['DCD_GH_RUN_ID', 'gh_run_id'],
// Names the GitHub check this run posts ("DeviceCloud / iOS"). Set it per job
// when a commit is tested more than once — GitHub matches required checks by
// name, so runs sharing a name share one branch-protection gate, and it
// follows whichever finished last. Keep the value fixed for a given job.
['DCD_CHECK_NAME', 'gh_check_name'],
];

export function getEnv(): EasEnv {
Expand Down