Skip to content

Commit bcf0960

Browse files
authored
Merge pull request #3829 from plotly/fix-dependabot-report
fix dependabot report
2 parents 8c4b5e6 + ce08226 commit bcf0960

3 files changed

Lines changed: 60 additions & 5 deletions

File tree

.github/actions/percy-exec/action.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
description: 'Working directory for the command'
1414
required: false
1515
default: '.'
16+
browser-executable:
17+
description: 'Path to a Chrome/Chromium binary for Percy to use. Defaults to the one found on PATH.'
18+
required: false
19+
default: ''
1620

1721
runs:
1822
using: 'composite'
@@ -23,7 +27,19 @@ runs:
2327
working-directory: ${{ inputs.working-directory }}
2428
env:
2529
PERCY_TOKEN: ${{ inputs.percy-token }}
26-
run: npx percy exec -- ${{ inputs.command }}
30+
PERCY_BROWSER_EXECUTABLE: ${{ inputs.browser-executable }}
31+
run: |
32+
# Percy otherwise downloads its own Chromium from storage.googleapis.com
33+
# on the first snapshot. That download stalls in CI, which blocks the
34+
# synchronous percy_snapshot() calls (so pytest never finishes and writes
35+
# no JUnit) and leaves an empty Percy build with no snapshots. Point Percy
36+
# at the Chrome already installed in the job so it skips the download.
37+
if [ -z "${PERCY_BROWSER_EXECUTABLE:-}" ]; then
38+
PERCY_BROWSER_EXECUTABLE="$(command -v google-chrome || command -v google-chrome-stable || command -v chrome || command -v chromium || command -v chromium-browser || true)"
39+
export PERCY_BROWSER_EXECUTABLE
40+
fi
41+
echo "PERCY_BROWSER_EXECUTABLE=${PERCY_BROWSER_EXECUTABLE:-<unset: Percy will download Chromium>}"
42+
npx percy exec -- ${{ inputs.command }}
2743
2844
- name: Run without Percy (fork PR)
2945
if: inputs.percy-token == ''

.github/workflows/post-test-status.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ jobs:
6868
test-report:
6969
name: Consolidated Test Report (Fork PR)
7070
runs-on: ubuntu-latest
71-
# Only run for fork PRs (non-fork PRs are handled in the main workflow)
71+
# Run for fork PRs and Dependabot PRs. Both run with a read-only
72+
# GITHUB_TOKEN in the main workflow, so the check run is created here in the
73+
# base-repo context instead. Other same-repo PRs are handled in the main workflow.
7274
if: |
7375
github.event.workflow_run.event == 'pull_request' &&
74-
github.event.workflow_run.head_repository.full_name != github.repository
76+
(github.event.workflow_run.head_repository.full_name != github.repository ||
77+
github.event.workflow_run.actor.login == 'dependabot[bot]')
7578
permissions:
7679
checks: write
7780
actions: read

.github/workflows/testing.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,14 @@ jobs:
620620
PERCY_TOKEN: ${{ matrix.python-version == '3.12' && secrets.PERCY_TOKEN || '' }}
621621
PERCY_ENABLE: ${{ matrix.python-version == '3.12' && '1' || '0' }}
622622
PERCY_PARALLEL_TOTAL: -1
623+
# Pin the build identity so every shard joins the same parallel build and
624+
# Percy links it to the PR. Auto-detection otherwise uses the ephemeral
625+
# merge SHA (refs/pull/N/merge), so the build never shows up on the PR.
626+
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_attempt }}
627+
PERCY_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
628+
PERCY_BRANCH: ${{ github.head_ref || github.ref_name }}
629+
PERCY_PULL_REQUEST: ${{ github.event.pull_request.number }}
630+
PERCY_TARGET_BRANCH: ${{ github.base_ref }}
623631

624632
steps:
625633
- name: Checkout repository
@@ -654,6 +662,7 @@ jobs:
654662
find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev,celery,diskcache]"' \;
655663
656664
- name: Setup Chrome and ChromeDriver
665+
id: setup-chrome
657666
uses: browser-actions/setup-chrome@v1
658667
with:
659668
chrome-version: stable
@@ -678,6 +687,7 @@ jobs:
678687
with:
679688
command: pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }}
680689
percy-token: ${{ secrets.PERCY_TOKEN }}
690+
browser-executable: ${{ steps.setup-chrome.outputs.chrome-path }}
681691

682692
- name: Upload test results
683693
if: always()
@@ -713,6 +723,14 @@ jobs:
713723
PERCY_TOKEN: ${{ matrix.python-version == '3.12' && secrets.PERCY_TOKEN || '' }}
714724
PERCY_ENABLE: ${{ matrix.python-version == '3.12' && '1' || '0' }}
715725
PERCY_PARALLEL_TOTAL: -1
726+
# Pin the build identity so every shard joins the same parallel build and
727+
# Percy links it to the PR. Auto-detection otherwise uses the ephemeral
728+
# merge SHA (refs/pull/N/merge), so the build never shows up on the PR.
729+
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_attempt }}
730+
PERCY_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
731+
PERCY_BRANCH: ${{ github.head_ref || github.ref_name }}
732+
PERCY_PULL_REQUEST: ${{ github.event.pull_request.number }}
733+
PERCY_TARGET_BRANCH: ${{ github.base_ref }}
716734

717735
steps:
718736
- name: Checkout repository
@@ -747,6 +765,7 @@ jobs:
747765
find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \;
748766
749767
- name: Setup Chrome and ChromeDriver
768+
id: setup-chrome
750769
uses: browser-actions/setup-chrome@v1
751770
with:
752771
chrome-version: stable
@@ -773,6 +792,7 @@ jobs:
773792
with:
774793
command: pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml
775794
percy-token: ${{ secrets.PERCY_TOKEN }}
795+
browser-executable: ${{ steps.setup-chrome.outputs.chrome-path }}
776796
working-directory: components/dash-html-components
777797

778798
- name: Upload test results
@@ -899,6 +919,14 @@ jobs:
899919
PERCY_TOKEN: ${{ matrix.python-version == '3.12' && secrets.PERCY_TOKEN || '' }}
900920
PERCY_ENABLE: ${{ matrix.python-version == '3.12' && '1' || '0' }}
901921
PERCY_PARALLEL_TOTAL: -1
922+
# Pin the build identity so every shard joins the same parallel build and
923+
# Percy links it to the PR. Auto-detection otherwise uses the ephemeral
924+
# merge SHA (refs/pull/N/merge), so the build never shows up on the PR.
925+
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_attempt }}
926+
PERCY_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
927+
PERCY_BRANCH: ${{ github.head_ref || github.ref_name }}
928+
PERCY_PULL_REQUEST: ${{ github.event.pull_request.number }}
929+
PERCY_TARGET_BRANCH: ${{ github.base_ref }}
902930

903931
steps:
904932
- name: Checkout repository
@@ -1056,6 +1084,13 @@ jobs:
10561084
if: always()
10571085
env:
10581086
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
1087+
# Must match the snapshot jobs so finalize targets the same parallel build
1088+
# and the result is attached to the PR head commit, not the merge SHA.
1089+
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_attempt }}
1090+
PERCY_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
1091+
PERCY_BRANCH: ${{ github.head_ref || github.ref_name }}
1092+
PERCY_PULL_REQUEST: ${{ github.event.pull_request.number }}
1093+
PERCY_TARGET_BRANCH: ${{ github.base_ref }}
10591094
steps:
10601095
- name: Finalize Main Percy Build
10611096
if: |
@@ -1093,8 +1128,9 @@ jobs:
10931128

10941129
- name: Publish Test Report
10951130
uses: dorny/test-reporter@v1
1096-
# Skip for fork PRs - handled by post-test-status.yml workflow_run
1097-
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
1131+
# Skip for fork PRs and Dependabot PRs - both run with a read-only
1132+
# GITHUB_TOKEN, so they're handled by post-test-status.yml workflow_run.
1133+
if: always() && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'))
10981134
with:
10991135
name: Test Results Summary
11001136
path: 'test-results/**/*.xml'

0 commit comments

Comments
 (0)