Skip to content

Commit 8fecbab

Browse files
authored
Merge pull request #55 from mongodb-developer/ci-weekly-schedule-codeowners
Add weekly scheduled CI run and CODEOWNERS
2 parents 96b0414 + d10b5b3 commit 8fecbab

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @mongodb-developer/learning-fuel

‎.github/workflows/main.yaml‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
branches: [ main ]
88
workflow_dispatch:
9+
schedule:
10+
- cron: '5 6 * * 1'
911

1012
jobs:
1113
build:
@@ -68,4 +70,44 @@ jobs:
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+
}

0 commit comments

Comments
 (0)