Skip to content

Commit 2a591c8

Browse files
committed
Gate diagnostic artifact uploads
1 parent 4a87098 commit 2a591c8

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ on:
1313
options:
1414
- direct
1515
- proxy
16+
upload_debug_artifacts:
17+
description: 'Upload redacted diagnostics on failure for this manual run'
18+
required: true
19+
default: 'false'
20+
type: choice
21+
options:
22+
- 'false'
23+
- 'true'
1624

1725
permissions:
1826
contents: write
@@ -71,15 +79,14 @@ jobs:
7179
GCP_SECRET_ID: ${{ vars.GCP_SECRET_ID }}
7280
SCHWAB_REDIRECT_URI: ${{ vars.SCHWAB_REDIRECT_URI }}
7381

74-
- name: Upload Error Screenshot
75-
if: failure()
82+
- name: Upload Redacted Diagnostics
83+
if: failure() && github.event_name == 'workflow_dispatch' && inputs.upload_debug_artifacts == 'true'
7684
uses: actions/upload-artifact@v7
7785
with:
78-
name: debug-screenshots
86+
name: redacted-diagnostics
7987
path: |
80-
*.png
8188
*_diagnostics.json
82-
retention-days: 3
89+
retention-days: 1
8390

8491
- name: Update Log (Bash Version)
8592
if: success()

tests/test_workflow_config_sources.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ grep -Eq "channel: ['\"]chrome['\"]" "$repo_dir/main.js"
2222
grep -Fq 'PW_TEST_SCREENSHOT_NO_FONTS_READY' "$repo_dir/main.js"
2323
grep -Fq '#placeholderCode' "$repo_dir/main.js"
2424
grep -Fq '#continueButton' "$repo_dir/main.js"
25-
grep -Fq ' *.png' "$workflow_file"
25+
grep -Fq 'upload_debug_artifacts:' "$workflow_file"
26+
grep -Fq 'Upload Redacted Diagnostics' "$workflow_file"
27+
grep -Fq "inputs.upload_debug_artifacts == 'true'" "$workflow_file"
2628
grep -Fq ' *_diagnostics.json' "$workflow_file"
2729

2830
if grep -Fq 'google-chrome-stable_current_amd64.deb' "$workflow_file"; then
@@ -35,6 +37,11 @@ if grep -Fq 'npx playwright install --with-deps chromium' "$workflow_file"; then
3537
exit 1
3638
fi
3739

40+
if grep -Fq ' *.png' "$workflow_file"; then
41+
echo "workflow should not upload screenshots by default" >&2
42+
exit 1
43+
fi
44+
3845
if grep -Fq 'secrets.GCP_PROJECT_ID' "$workflow_file"; then
3946
echo "workflow should not read GCP_PROJECT_ID from secrets anymore" >&2
4047
exit 1

0 commit comments

Comments
 (0)