Skip to content
Closed
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
28 changes: 20 additions & 8 deletions .github/actions/cancel-e2e-runs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,30 @@ runs:
};

const markCommitStatusesCancelled = async (sha) => {
const skippedOutput = {
title: reason.substring(0, 140),
summary: reason.substring(0, 140),
};
for (const statusContext of E2E_STATUS_CONTEXTS) {
try {
await github.rest.repos.createCommitStatus({
owner,
repo,
sha,
state: 'error',
context: statusContext,
description: reason.substring(0, 140),
// Update the existing in-progress run if one exists; otherwise create.
const { data: { check_runs } } = await github.rest.checks.listForRef({
owner, repo, ref: sha, check_name: statusContext, filter: 'latest', per_page: 1,
});
const existing = check_runs.find(r => r.status !== 'completed');
if (existing) {
await github.rest.checks.update({
owner, repo, check_run_id: existing.id,
status: 'completed', conclusion: 'skipped', output: skippedOutput,
});
} else {
await github.rest.checks.create({
owner, repo, name: statusContext, head_sha: sha,
status: 'completed', conclusion: 'skipped', output: skippedOutput,
});
}
} catch (err) {
core.warning(`createCommitStatus ${statusContext} on ${sha}: ${err.message}`);
core.warning(`markCommitStatusesCancelled ${statusContext} on ${sha}: ${err.message}`);
}
}
};
Expand Down
57 changes: 49 additions & 8 deletions .github/actions/update-commit-status/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: update-commit-status
description: Set a GitHub commit status (Node 24 / github-script v9)
description: Set a GitHub check run status (Node 24 / github-script v9)

inputs:
repository_full_name:
Expand All @@ -12,7 +12,7 @@ inputs:
description:
required: true
status:
description: success | failure | pending | error
description: success | failure | pending | error | skipped
required: true
target_url:
required: false
Expand All @@ -33,12 +33,53 @@ runs:
script: |
const [owner, repo] = process.env.REPOSITORY_FULL_NAME.split('/');
const targetUrl = process.env.TARGET_URL?.trim();
await github.rest.repos.createCommitStatus({
const status = process.env.STATUS;
const description = (process.env.DESCRIPTION || '').substring(0, 140);

const validStatuses = new Set(['success', 'failure', 'pending', 'error', 'skipped']);
if (!validStatuses.has(status)) {
core.setFailed(`Unsupported status "${status}". Expected one of: ${[...validStatuses].join(', ')}`);
return;
}

const isCompleted = status !== 'pending';
const conclusionMap = { success: 'success', failure: 'failure', error: 'failure', skipped: 'skipped' };

// Use the workflow run ID as a stable external_id so the completion call
// targets exactly the check run this workflow created, not a concurrent one.
const externalId = String(context.runId);

const payload = {
status: isCompleted ? 'completed' : 'in_progress',
...(isCompleted ? { conclusion: conclusionMap[status] } : {}),
output: { title: description, summary: description },
...(targetUrl ? { details_url: targetUrl } : {}),
};

if (isCompleted) {
// Find the in-progress run that this workflow created (matched by external_id).
const { data: { check_runs } } = await github.rest.checks.listForRef({
owner,
repo,
ref: process.env.COMMIT_SHA,
check_name: process.env.CONTEXT,
filter: 'all',
per_page: 100,
});
const existing = check_runs.find(
r => r.external_id === externalId && r.status !== 'completed',
);
if (existing) {
await github.rest.checks.update({ owner, repo, check_run_id: existing.id, ...payload });
return;
}
}

await github.rest.checks.create({
owner,
repo,
sha: process.env.COMMIT_SHA,
state: process.env.STATUS,
context: process.env.CONTEXT,
description: (process.env.DESCRIPTION || '').substring(0, 140),
...(targetUrl ? {target_url: targetUrl} : {}),
name: process.env.CONTEXT,
head_sha: process.env.COMMIT_SHA,
external_id: externalId,
...payload,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
2 changes: 1 addition & 1 deletion .github/workflows/e2e-cancel-on-label-removal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
actions: write
statuses: write
checks: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Cancel in-progress E2E workflow runs
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/e2e-detox-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ jobs:
runs-on: ubuntu-22.04
permissions:
actions: write
checks: write
contents: read
pull-requests: read
issues: read
statuses: write
outputs:
e2e_override: ${{ steps.policy.outputs.e2e_override }}
steps:
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
contents: read
statuses: write
checks: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
Expand All @@ -169,7 +169,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
contents: read
statuses: write
checks: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
Expand All @@ -192,7 +192,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
contents: read
statuses: write
checks: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
Expand Down Expand Up @@ -458,7 +458,7 @@ jobs:
- provision-servers
permissions:
contents: read
statuses: write
checks: write
actions: read
if: |
!cancelled() &&
Expand All @@ -485,7 +485,7 @@ jobs:
- provision-servers
permissions:
contents: read
statuses: write
checks: write
actions: read
if: |
!cancelled() &&
Expand Down Expand Up @@ -533,7 +533,7 @@ jobs:
- validate-maestro-flow-headers
permissions:
contents: read
statuses: write
checks: write
actions: read
if: |
!cancelled() &&
Expand Down Expand Up @@ -562,7 +562,7 @@ jobs:
- validate-maestro-flow-headers
permissions:
contents: read
statuses: write
checks: write
actions: read
if: |
!cancelled() &&
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/e2e-detox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
if: always() && (inputs.PLATFORM == 'ios' || inputs.PLATFORM == 'both')
permissions:
contents: read
statuses: write
checks: write
needs:
- run-ios-tests
steps:
Expand All @@ -133,15 +133,15 @@ jobs:
|| (needs.run-ios-tests.outputs.FAILURES == '0' && needs.run-ios-tests.outputs.SKIPPED > '0') && format('{0} passed, {1} skipped', needs.run-ios-tests.outputs.PASSES, needs.run-ios-tests.outputs.SKIPPED)
|| needs.run-ios-tests.outputs.FAILURES == '0' && format('All {0} tests passed', needs.run-ios-tests.outputs.TOTAL)
|| format('{0} passed, {1} failed, {2} skipped', needs.run-ios-tests.outputs.PASSES || '?', needs.run-ios-tests.outputs.FAILURES || '?', needs.run-ios-tests.outputs.SKIPPED || '0') }}
status: ${{ (needs.run-ios-tests.result == 'skipped' && 'failure') || needs.run-ios-tests.outputs.STATUS || 'failure' }}
target_url: ${{ needs.run-ios-tests.outputs.TARGET_URL }}
status: ${{ (needs.run-ios-tests.result == 'skipped' && 'skipped') || needs.run-ios-tests.outputs.STATUS || 'failure' }}
target_url: ${{ needs.run-ios-tests.outputs.TARGET_URL || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}

update-final-status-android:
runs-on: ubuntu-22.04
if: always() && (inputs.PLATFORM == 'android' || inputs.PLATFORM == 'both')
permissions:
contents: read
statuses: write
checks: write
needs:
- run-android-tests
steps:
Expand All @@ -161,15 +161,15 @@ jobs:
|| (needs.run-android-tests.outputs.FAILURES == '0' && needs.run-android-tests.outputs.SKIPPED > '0') && format('{0} passed, {1} skipped', needs.run-android-tests.outputs.PASSES, needs.run-android-tests.outputs.SKIPPED)
|| needs.run-android-tests.outputs.FAILURES == '0' && format('All {0} tests passed', needs.run-android-tests.outputs.TOTAL)
|| format('{0} passed, {1} failed, {2} skipped', needs.run-android-tests.outputs.PASSES || '?', needs.run-android-tests.outputs.FAILURES || '?', needs.run-android-tests.outputs.SKIPPED || '0') }}
status: ${{ (needs.run-android-tests.result == 'skipped' && 'failure') || needs.run-android-tests.outputs.STATUS || 'failure' }}
target_url: ${{ needs.run-android-tests.outputs.TARGET_URL }}
status: ${{ (needs.run-android-tests.result == 'skipped' && 'skipped') || needs.run-android-tests.outputs.STATUS || 'failure' }}
target_url: ${{ needs.run-android-tests.outputs.TARGET_URL || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}

update-final-status-ipad:
runs-on: ubuntu-22.04
if: always() && (inputs.PLATFORM == 'ios' || inputs.PLATFORM == 'both')
permissions:
contents: read
statuses: write
checks: write
needs:
- run-ios-ipad-tests
steps:
Expand All @@ -189,5 +189,5 @@ jobs:
|| (needs.run-ios-ipad-tests.outputs.FAILURES == '0' && needs.run-ios-ipad-tests.outputs.SKIPPED > '0') && format('{0} passed, {1} skipped', needs.run-ios-ipad-tests.outputs.PASSES, needs.run-ios-ipad-tests.outputs.SKIPPED)
|| needs.run-ios-ipad-tests.outputs.FAILURES == '0' && format('All {0} tests passed', needs.run-ios-ipad-tests.outputs.TOTAL)
|| format('{0} passed, {1} failed, {2} skipped', needs.run-ios-ipad-tests.outputs.PASSES || '?', needs.run-ios-ipad-tests.outputs.FAILURES || '?', needs.run-ios-ipad-tests.outputs.SKIPPED || '0') }}
status: ${{ (needs.run-ios-ipad-tests.result == 'skipped' && 'failure') || needs.run-ios-ipad-tests.outputs.STATUS || 'failure' }}
target_url: ${{ needs.run-ios-ipad-tests.outputs.TARGET_URL }}
status: ${{ (needs.run-ios-ipad-tests.result == 'skipped' && 'skipped') || needs.run-ios-ipad-tests.outputs.STATUS || 'failure' }}
target_url: ${{ needs.run-ios-ipad-tests.outputs.TARGET_URL || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
7 changes: 5 additions & 2 deletions .github/workflows/e2e-ios-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ jobs:

- name: Install Homebrew Dependencies
run: |
brew trust wix/brew 2>/dev/null || true
# Trust must come after tap — the tap directory must exist before brew trust can act on it.
brew tap wix/brew
brew install applesimutils || true
brew trust wix/brew
brew install applesimutils
# Cache restores Cellar without /opt/homebrew/bin symlinks — link the tap formula explicitly.
brew link --overwrite --force wix/brew/applesimutils 2>/dev/null \
|| brew link --overwrite applesimutils
Expand Down Expand Up @@ -717,6 +718,7 @@ jobs:

- name: Save report Detox Dependencies
id: report-link
continue-on-error: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
run: |
cd detox
npm ci
Expand Down Expand Up @@ -752,6 +754,7 @@ jobs:

- name: Set Target URL
id: set-url
if: steps.report-link.outcome == 'success'
run: |
echo "TARGET_URL=https://${{ env.DETOX_AWS_S3_BUCKET }}.s3.amazonaws.com/${{ steps.s3.outputs.path }}/jest-stare/ios-report.html" >> ${GITHUB_OUTPUT}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-label-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
actions: write
statuses: write
checks: write
issues: write
pull-requests: write
steps:
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
issues: write
pull-requests: write
actions: write
statuses: write
checks: write
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

Expand Down
Loading
Loading