diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml index 28dbfb6d..ac890d01 100644 --- a/.github/workflows/ci_publish.yml +++ b/.github/workflows/ci_publish.yml @@ -27,6 +27,14 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install mystmd + run: npm install mystmd + - name: Setup Python uses: actions/setup-python@v6 with: @@ -45,6 +53,58 @@ jobs: publish_dir: ./_build/html/ commit_message: ${{ github.event.head_commit.message }} + - name: Create issue or comment if run fails + if: failure() + uses: actions/github-script@v7 + with: + script: | + const title = `❌ Job failed: ${context.job} Run #${context.runNumber}`; + + // Search for existing open issue with the same title + const issues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: 'workflow-failure', + per_page: 100 + }); + + const existingIssue = issues.data.find(issue => issue.title === title); + + const body = `## Job Failed + + **Job:** ${context.job} + **Workflow:** ${context.workflow} + **Event:** ${context.eventName} + **Run ID:** ${context.runId} + **Run Number:** ${context.runNumber} + **Run Attempt:** ${context.runAttempt} + **Ref:** ${context.ref} + **Ref Name:** ${context.refName} + **SHA:** ${context.sha} + **Short SHA:** ${context.sha.substring(0, 7)} + + [View run details](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`; + + if (existingIssue) { + // Add comment to existing issue (for retry attempts) + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: existingIssue.number, + body: body + }); + } else { + // Create new issue + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: title, + body: body, + labels: ['workflow-failure'] + }); + } + deploy_notebooks: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} name: Deploy deployed_notebook branch @@ -62,4 +122,4 @@ jobs: git rm --cached -r . git add --pathspec-from-file=deployed_notebooks_manifest.in --force git commit -m "Deploy notebooks for commit ${gith}" - git push origin deployed_notebooks --force \ No newline at end of file + git push origin deployed_notebooks --force diff --git a/.github/workflows/ci_tests_run_notebooks.yml b/.github/workflows/ci_tests_run_notebooks.yml index 4c816238..d0f87d52 100644 --- a/.github/workflows/ci_tests_run_notebooks.yml +++ b/.github/workflows/ci_tests_run_notebooks.yml @@ -65,6 +65,14 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install mystmd + run: npm install mystmd + - name: Setup Python uses: actions/setup-python@v6 with: