Skip to content

Commit b0fdef9

Browse files
fengmk2claude
andcommitted
ci(e2e): add daily scheduled run with failure notification
- Run E2E tests daily at 0:00 GMT (8:00 AM Shanghai time) - Create GitHub issue on failure with 'e2e-failure' label - Reuse existing issue by adding comments on subsequent failures - Only notify on scheduled run failures, not on success 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 9f1d497 commit b0fdef9

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/e2e-test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ permissions: {}
44

55
on:
66
workflow_dispatch:
7+
schedule:
8+
# Run every day at 0:00 GMT (8:00 AM Singapore time)
9+
- cron: '0 0 * * *'
710
push:
811
branches:
912
- main
@@ -156,3 +159,46 @@ jobs:
156159
- name: Run vite-plus commands in ${{ matrix.project.name }}
157160
working-directory: ecosystem-ci/${{ matrix.project.name }}
158161
run: ${{ matrix.project.command }}
162+
163+
notify-failure:
164+
name: Notify on failure
165+
runs-on: ubuntu-latest
166+
needs: e2e-test
167+
# debug
168+
# if: ${{ failure() && github.event_name == 'schedule' }}
169+
permissions:
170+
issues: write
171+
steps:
172+
- name: Create or update GitHub issue on failure
173+
env:
174+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175+
GH_REPO: ${{ github.repository }}
176+
run: |
177+
ISSUE_TITLE="E2E Test Scheduled Run Failed"
178+
ISSUE_LABEL="e2e-failure"
179+
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
180+
181+
# Search for existing open issue with the label
182+
EXISTING_ISSUE=$(gh issue list --label "$ISSUE_LABEL" --state open --json number --jq '.[0].number')
183+
184+
if [ -z "$EXISTING_ISSUE" ]; then
185+
# Create new issue if none exists
186+
gh issue create \
187+
--title "$ISSUE_TITLE" \
188+
--label "$ISSUE_LABEL" \
189+
--body "The scheduled E2E test run has failed.
190+
191+
**Failed Run:** $RUN_URL
192+
**Time:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')
193+
194+
Please investigate the failure and fix any issues."
195+
echo "Created new issue"
196+
else
197+
# Add comment to existing issue
198+
gh issue comment "$EXISTING_ISSUE" \
199+
--body "The scheduled E2E test run has failed again.
200+
201+
**Failed Run:** $RUN_URL
202+
**Time:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
203+
echo "Added comment to issue #$EXISTING_ISSUE"
204+
fi

0 commit comments

Comments
 (0)