File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ * @ mongodb-developer/learning-fuel
Original file line number Diff line number Diff line change 66 pull_request :
77 branches : [ main ]
88 workflow_dispatch :
9+ schedule :
10+ - cron : ' 5 6 * * 1'
911
1012jobs :
1113 build :
6870 working-directory : mern/client
6971 start : npm run dev
7072 wait-on : ' http://localhost:5173'
71-
73+
74+ notify-on-failure :
75+ needs : build
76+ if : failure()
77+ runs-on : ubuntu-latest
78+ permissions :
79+ issues : write
80+ steps :
81+ - name : File or update CI failure issue for @mongodb-developer/learning-fuel
82+ uses : actions/github-script@v7
83+ with :
84+ script : |
85+ const title = `CI failure on ${context.ref}`;
86+ const body = [
87+ '@mongodb-developer/learning-fuel the CI workflow failed.',
88+ '',
89+ `Workflow: ${context.workflow}`,
90+ `Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
91+ ].join('\n');
92+ const { data: existing } = await github.rest.issues.listForRepo({
93+ owner: context.repo.owner,
94+ repo: context.repo.repo,
95+ state: 'open',
96+ labels: 'ci-failure',
97+ });
98+ if (existing.length > 0) {
99+ await github.rest.issues.createComment({
100+ owner: context.repo.owner,
101+ repo: context.repo.repo,
102+ issue_number: existing[0].number,
103+ body,
104+ });
105+ } else {
106+ await github.rest.issues.create({
107+ owner: context.repo.owner,
108+ repo: context.repo.repo,
109+ title,
110+ body,
111+ labels: ['ci-failure'],
112+ });
113+ }
You can’t perform that action at this time.
0 commit comments