File tree Expand file tree Collapse file tree 8 files changed +107
-37
lines changed Expand file tree Collapse file tree 8 files changed +107
-37
lines changed Original file line number Diff line number Diff line change 11name : Examples - APO
22permissions :
33 contents : read
4+ issues : write
45on :
56 schedule :
67 # Every day at 3 AM UTC+8
1213 types : [ci-apo, ci-all]
1314
1415jobs :
16+ dispatch-notify :
17+ if : github.event_name == 'repository_dispatch'
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Comment with workflow run link
22+ uses : actions/github-script@v8
23+ with :
24+ script : |
25+ const dispatchComment = require('./scripts/dispatch_comment.js');
26+ await dispatchComment({ core, github, context });
27+
1528 apo :
1629 if : >
1730 github.event_name != 'repository_dispatch' ||
Original file line number Diff line number Diff line change 11name : Examples - Calc-X
22permissions :
33 contents : read
4+ issues : write
45on :
56 schedule :
67 # Every day at 3 AM UTC+8
1213 types : [ci-calc-x, ci-all]
1314
1415jobs :
16+ dispatch-notify :
17+ if : github.event_name == 'repository_dispatch'
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Comment with workflow run link
22+ uses : actions/github-script@v8
23+ with :
24+ script : |
25+ const dispatchComment = require('./scripts/dispatch_comment.js');
26+ await dispatchComment({ core, github, context });
27+
1528 calc-x :
1629 if : >
1730 github.event_name != 'repository_dispatch' ||
Original file line number Diff line number Diff line change 11name : Examples - Backward Compatibility
22permissions :
33 contents : read
4+ issues : write
45on :
56 schedule :
67 # Every day at 6 AM UTC+8
1213 types : [ci-compat, ci-all]
1314
1415jobs :
16+ dispatch-notify :
17+ if : github.event_name == 'repository_dispatch'
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Comment with workflow run link
22+ uses : actions/github-script@v8
23+ with :
24+ script : |
25+ const dispatchComment = require('./scripts/dispatch_comment.js');
26+ await dispatchComment({ core, github, context });
27+
1528 backward-compatibility :
1629 if : >
1730 github.event_name != 'repository_dispatch' ||
Original file line number Diff line number Diff line change 11name : Examples - Spider
22permissions :
33 contents : read
4+ issues : write
45on :
56 schedule :
67 # Every day at 4 AM UTC+8
1213 types : [ci-spider, ci-all]
1314
1415jobs :
16+ dispatch-notify :
17+ if : github.event_name == 'repository_dispatch'
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Comment with workflow run link
22+ uses : actions/github-script@v8
23+ with :
24+ script : |
25+ const dispatchComment = require('./scripts/dispatch_comment.js');
26+ await dispatchComment({ core, github, context });
27+
1528 spider :
1629 if : >
1730 github.event_name != 'repository_dispatch' ||
Original file line number Diff line number Diff line change 11name : Examples - Unsloth
22permissions :
33 contents : read
4+ issues : write
45on :
56 schedule :
67 # Every day at 5 AM UTC+8
1213 types : [ci-unsloth, ci-all]
1314
1415jobs :
16+ dispatch-notify :
17+ if : github.event_name == 'repository_dispatch'
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Comment with workflow run link
22+ uses : actions/github-script@v8
23+ with :
24+ script : |
25+ const dispatchComment = require('./scripts/dispatch_comment.js');
26+ await dispatchComment({ core, github, context });
27+
1528 unsloth :
1629 if : >
1730 github.event_name != 'repository_dispatch' ||
Original file line number Diff line number Diff line change 11name : GPU Test
22permissions :
33 contents : read
4+ issues : write
45on :
56 schedule :
67 # Every day at 5 AM UTC+8
1213 types : [ci-unsloth, ci-all]
1314
1415jobs :
16+ dispatch-notify :
17+ if : github.event_name == 'repository_dispatch'
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Comment with workflow run link
22+ uses : actions/github-script@v8
23+ with :
24+ script : |
25+ const dispatchComment = require('./scripts/dispatch_comment.js');
26+ await dispatchComment({ core, github, context });
27+
1528 tests-full :
1629 if : >
1730 github.event_name != 'repository_dispatch' ||
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft. All rights reserved.
2+
3+ module . exports = async function dispatchComment ( { core, github, context } ) {
4+ const payload = context . payload . client_payload || { } ;
5+ const pullNumber = payload . pull_number ;
6+
7+ if ( ! pullNumber ) {
8+ core . notice (
9+ "No pull_number found in repository_dispatch payload; skipping comment."
10+ ) ;
11+ return ;
12+ }
13+
14+ const { owner, repo } = context . repo ;
15+ const action =
16+ context . payload . action || payload . ci_label || context . eventName || "dispatch" ;
17+ const runId = process . env . GITHUB_RUN_ID ;
18+ const workflowName = context . workflow || "Workflow" ;
19+ const runUrl = `https://github.com/${ owner } /${ repo } /actions/runs/${ runId } ` ;
20+
21+ const body = `🚀 ${ workflowName } dispatched via \`${ action } \`. Track progress here: ${ runUrl } ` ;
22+
23+ await github . rest . issues . createComment ( {
24+ owner,
25+ repo,
26+ issue_number : pullNumber ,
27+ body,
28+ } ) ;
29+ } ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments