Skip to content

Commit a3a2e06

Browse files
committed
refactor: replace error handling helper and migrate CI failure notifications from email to GitHub issues
1 parent 229cf05 commit a3a2e06

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed
Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Failure Email
1+
name: CI Failure Issue
22

33
on:
44
workflow_run:
@@ -13,20 +13,35 @@ on:
1313
jobs:
1414
notify:
1515
if: contains(fromJSON('["failure","timed_out","action_required"]'), github.event.workflow_run.conclusion)
16+
permissions:
17+
issues: write
1618
runs-on: ubuntu-latest
1719
steps:
18-
- name: Send failure email
19-
uses: dawidd6/action-send-mail@v16
20-
with:
21-
connection_url: ${{ secrets.CI_FAILURE_MAIL_CONNECTION }}
22-
subject: "[CI failed] ${{ github.repository }} / ${{ github.event.workflow_run.name }}"
23-
to: sunnylqm@gmail.com
24-
from: "GitHub Actions <sunnylqm@gmail.com>"
25-
body: |
26-
Repository: ${{ github.repository }}
27-
Workflow: ${{ github.event.workflow_run.name }}
28-
Conclusion: ${{ github.event.workflow_run.conclusion }}
29-
Branch: ${{ github.event.workflow_run.head_branch }}
30-
Commit: ${{ github.event.workflow_run.head_sha }}
31-
Actor: ${{ github.event.workflow_run.actor.login }}
32-
Run: ${{ github.event.workflow_run.html_url }}
20+
- name: Create failure issue
21+
env:
22+
GH_TOKEN: ${{ github.token }}
23+
REPOSITORY: ${{ github.repository }}
24+
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
25+
CONCLUSION: ${{ github.event.workflow_run.conclusion }}
26+
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
27+
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
28+
ACTOR: ${{ github.event.workflow_run.actor.login }}
29+
RUN_URL: ${{ github.event.workflow_run.html_url }}
30+
run: |
31+
body_file="$(mktemp)"
32+
cat > "$body_file" <<EOF
33+
@sunnylqm CI run failed.
34+
35+
Repository: $REPOSITORY
36+
Workflow: $WORKFLOW_NAME
37+
Conclusion: $CONCLUSION
38+
Branch: $HEAD_BRANCH
39+
Commit: $HEAD_SHA
40+
Actor: $ACTOR
41+
Run: $RUN_URL
42+
EOF
43+
44+
gh issue create \
45+
--repo "$REPOSITORY" \
46+
--title "[CI failed] $REPOSITORY / $WORKFLOW_NAME" \
47+
--body-file "$body_file"

harmony/pushy/src/main/ets/PushyTurboModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ export class PushyTurboModule extends UITurboModule {
174174
this.context.switchVersion(hash);
175175
return true;
176176
} catch (error) {
177-
logger.error(TAG, `setNeedUpdate failed: ${this.getErrorMessage(error)}`);
178-
throw Error(`switchVersionLater failed: ${this.getErrorMessage(error)}`);
177+
logger.error(TAG, `setNeedUpdate failed: ${getErrorMessage(error)}`);
178+
throw Error(`switchVersionLater failed: ${getErrorMessage(error)}`);
179179
}
180180
}
181181

0 commit comments

Comments
 (0)