diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..8eac885 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @mongodb-developer/learning-fuel diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a803944..47c3903 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,6 +6,8 @@ on: pull_request: branches: [ main ] workflow_dispatch: + schedule: + - cron: '5 6 * * 1' jobs: build: @@ -68,4 +70,44 @@ jobs: working-directory: mern/client start: npm run dev wait-on: 'http://localhost:5173' - + + notify-on-failure: + needs: build + if: failure() + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: File or update CI failure issue for @mongodb-developer/learning-fuel + uses: actions/github-script@v7 + with: + script: | + const title = `CI failure on ${context.ref}`; + const body = [ + '@mongodb-developer/learning-fuel the CI workflow failed.', + '', + `Workflow: ${context.workflow}`, + `Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, + ].join('\n'); + const { data: existing } = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: 'ci-failure', + }); + if (existing.length > 0) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: existing[0].number, + body, + }); + } else { + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title, + body, + labels: ['ci-failure'], + }); + }