A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
ci: comment on PRs for helpful fixes (#7451)
Myles Scolnickc33759e73c0d
diff --git a/.github/actions/pr-comment-on-failure/action.yaml b/.github/actions/pr-comment-on-failure/action.yamlnew file mode 100644index 0000000000..bbdc73bd16--- /dev/null+++ b/.github/actions/pr-comment-on-failure/action.yaml@@ -0,0 +1,63 @@+name: "PR Comment on Failure"+description: "Comments on PRs from forks when checks fail"+inputs:+ check-name:+ description: "The name of the check that failed"+ required: true+ command:+ description: "The command that contributors should run"+ required: true+ github-token:+ description: "GitHub token for commenting"+ required: true++runs:+ using: "composite"+ steps:+ - name: Comment on PR+ if: github.event.pull_request.head.repo.fork == true+ uses: actions/github-script@v7+ with:+ github-token: ${{ inputs.github-token }}+ script: |+ const checkName = '${{ inputs.check-name }}';+ const command = '${{ inputs.command }}';++ const body = `👋 It looks like the **${checkName}** check failed.++ To fix this locally, please run:++ \`\`\`bash+ ${command}+ \`\`\`+ `;++ // Check if we already commented+ const { data: comments } = await github.rest.issues.listComments({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ });++ const botComment = comments.find(comment =>+ comment.user.type === 'Bot' &&+ comment.body.includes(checkName)+ );++ if (botComment) {+ // Update existing comment+ await github.rest.issues.updateComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: botComment.id,+ body: body+ });+ } else {+ // Create new comment+ await github.rest.issues.createComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ body: body+ });+ }diff --git a/.github/workflows/test_be.yaml b/.github/workflows/test_be.yamlindex 9347aa5e1d..bafbb2bfbc 100644--- a/.github/workflows/test_be.yaml+++ b/.github/workflows/test_be.yaml@@ -7,6 +7,7 @@ on:permissions:contents: read+ pull-requests: writeenv:MARIMO_SKIP_UPDATE_CHECK: 1@@ -46,8 +47,17 @@ jobs:uses: pypa/hatch@install- name: 📚 Build docs+ id: docsrun: hatch run docs:build --strict+ - name: Comment on docs failure+ if: failure() && steps.docs.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "docs build"+ command: "hatch run docs:build --strict"+ github-token: ${{ secrets.GITHUB_TOKEN }}+test_check:needs: changesif: ${{ needs.changes.outputs.backend == 'true' }}@@ -64,11 +74,29 @@ jobs:uses: pypa/hatch@install- name: 🧹 Lint+ id: lintrun: hatch run lint- name: 🔍 Typecheck+ id: typecheckrun: hatch run typecheck:check+ - name: Comment on lint failure+ if: failure() && steps.lint.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "lint"+ command: "hatch run lint"+ github-token: ${{ secrets.GITHUB_TOKEN }}++ - name: Comment on typecheck failure+ if: failure() && steps.typecheck.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "typecheck"+ command: "hatch run typecheck:check"+ github-token: ${{ secrets.GITHUB_TOKEN }}+# For PRs, we only run the tests for the changed files.# If there is a `test-all` label, we run the tests across unchanged files as well.test_python:diff --git a/.github/workflows/test_fe.yaml b/.github/workflows/test_fe.yamlindex 8570f7fa12..2906b15cfd 100644--- a/.github/workflows/test_fe.yaml+++ b/.github/workflows/test_fe.yaml@@ -1,6 +1,7 @@name: Test FEpermissions:contents: read+ pull-requests: writeon:push:@@ -51,11 +52,29 @@ jobs:- name: 📦 pnpm dedupeif: github.event_name == 'pull_request'+ id: deduperun: pnpm dedupe --check- name: 🧹 Lint+ id: lintrun: pnpm turbo lint+ - name: Comment on lint failure+ if: failure() && steps.lint.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "lint"+ command: "pnpm turbo lint"+ github-token: ${{ secrets.GITHUB_TOKEN }}++ - name: Comment on dedupe failure+ if: failure() && steps.dedupe.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "dedupe"+ command: "pnpm dedupe"+ github-token: ${{ secrets.GITHUB_TOKEN }}+test_frontend:needs: changesif: ${{ needs.changes.outputs.frontend == 'true' }}@@ -80,11 +99,29 @@ jobs:uses: ./.github/actions/install- name: 🔎 Type check+ id: typecheckrun: pnpm turbo typecheck- name: 🧪 Test+ id: testrun: pnpm turbo test+ - name: Comment on typecheck failure+ if: failure() && steps.typecheck.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "typecheck"+ command: "pnpm turbo typecheck"+ github-token: ${{ secrets.GITHUB_TOKEN }}++ - name: Comment on test failure+ if: failure() && steps.test.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "test"+ command: "pnpm turbo test"+ github-token: ${{ secrets.GITHUB_TOKEN }}+build_frontend:needs: changesif: ${{ needs.changes.outputs.frontend == 'true' }}@@ -120,6 +157,7 @@ jobs:fi- name: 📦 Build+ id: buildrun: pnpm turbo buildenv:NODE_ENV: production@@ -133,3 +171,11 @@ jobs:npm version 0.0.0 --no-git-tag-versionpnpm turbo build:islands./islands/validate.sh++ - name: Comment on build failure+ if: failure() && steps.build.outcome == 'failure'+ uses: ./.github/actions/pr-comment-on-failure+ with:+ check-name: "build"+ command: "pnpm turbo build"+ github-token: ${{ secrets.GITHUB_TOKEN }}